Coder Social home page Coder Social logo

digitalfabrik / lunes-cms Goto Github PK

View Code? Open in Web Editor NEW
20.0 9.0 8.0 22.26 MB

The back end for the Lunes vocabulary trainer. Front end: https://github.com/digitalfabrik/lunes-app.

Home Page: https://lunes.app

License: Apache License 2.0

Python 78.80% JavaScript 4.47% CSS 2.32% HTML 5.90% Shell 8.52%
vocabulary-learning vocabulary-trainer content-management-system django python

lunes-cms's Introduction

CircleCI Coverage Documentation Status PyPi License Code style: black Pylint

Lunes CMS

Logo Lunes - Vocabulary for your profession.

This is a Django 3 based content management system for the vocabulary trainer app Lunes, a project powered by Tür an Tür – Digitalfabrik gGmbH. The main goal is to develop an application which facilitates migrants to acquire technical and subject-specific vocabulary. For more information please see our GoVolunteer ad.

TL;DR

Prerequisites

Following packages are required before installing the project (install them with your package manager):

  • python3.8 or higher
  • python3-pip
  • python3-venv
  • libpq-dev to compile psycopg2
  • gettext and pcregrep to use the translation features
  • ffmpeg for audio processing

E.g. on Debian-based distributions, use:

cat requirements.system | xargs sudo apt-get install

Installation

git clone [email protected]:digitalfabrik/lunes-cms.git
cd lunes-cms
./tools/install.sh

Run development server

./tools/run.sh
  • Go to your browser and open the URL http://localhost:8080
  • Default user is "lunes" with password "lunes".

Development documentation

For detailed instructions and the source code reference have a look at our documentation:

API documentation

The API usage documentation is available here:

License

Copyright © 2020 Tür an Tür - Digitalfabrik gGmbH and individual contributors. All rights reserved.

This project is licensed under the Apache 2.0 License, see LICENSE and NOTICE.md.

lunes-cms's People

Contributors

batcapricorn avatar bob606 avatar deliverino[bot] avatar denn1smay avatar dependabot[bot] avatar joeystk avatar kategithub12 avatar lucasronchetti13 avatar mael-fosso avatar mizukitemma avatar oliversieberling avatar svenseeberg avatar timobrembeck avatar ulliholtgrave avatar ztefanie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lunes-cms's Issues

Create Django-REST Framework

  • create a REST Framework that can be used for GET and POST requests
  • enable other technologies like React Native/Exponent to access the application's data

Rename Model Field

The word field is used very often in IT, mostly referring to single values in databases. Reading field in code therefore can be very misleading. I think that Discipline would be a better name for the Fields model.

Clean Up

Delete unnecessary code

In order to clean up our repository, it may be useful to delete "old" code, which is not in production any more, e.g.:

  • JS libraries
  • Bootstrap
  • script.js file

Linting

Along the way, some minor code style issues should be fixed:

Docstrings

Adapt docstring format to sphinx docstring format: https://integreat.github.io/integreat-cms/documentation.html#docstrings

Manage Admin Authentication

  • each organization has its own profile, which can be used to create customized trainings sets
  • training sets/areas should always be linked to an organization. An admin can view his proper content as well as the general Lunes content, which may refer to an "General Admin" or similar
  • this issue is linked with issue #64
  • frontend perspective: with the help of an access token or similar a user should be able to have access to the training sets of the respective organization (e.g. the one he/she works for)

Add modules count

Issue:

  • the frontend needs the number of training sets when calling /api/disciplines/ for each discipline object
  • the frontend needs the number of documents when calling api/training_set/[DISCIPLINE_ID] for each training set_object

Solution:

  • added Count annotation to the respective classes in views.py
  • added the respective attribute to the corresponding serializers

Modify button setup

Instead of offering the user to click either on "Solve" or "Next Word", first show just the button "Verify".

Hint Button

  • Display hint button during session
  • If pressed, show user first letter and word length
  • If pressed, input can only achieve "almost correct" status

Create Organizations Module

  • create organizations module
  • respective trainings sets/areas should then be linked to an organization
  • long term goal: after an admin logged in, he/she can create their own trainings sets (which are yet again only linked to that admin)

Solve warning caused by easy thumbnails module

Problem
Running the server causes the following warning:

easy_thumbnails.Source: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
	HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
easy_thumbnails.Thumbnail: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
	HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
easy_thumbnails.ThumbnailDimensions: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
	HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.

Improve JavaScript code

Currently, the project is just a mock up. Improve Java Script to make it more flexible and maintainable.

User form to propose new words

  • User should have access to an online form to submit own vocabulary suggestions
  • Users should not need own login credentials to do this

Reorganize modules and data structures

Features

  1. Alternative words should be created within an word object (instead of creating an alternative word and linking it to its "parent" word
  2. Training sets and words should have an n:m relationship (instead of 1:n)
  3. within a training set, it should be possible to dynamically add words (instead of linking each word individually to a training set

Proposed solution

  1. Use nested modules to alter the admin settings
  2. Use the many-to-many django feature

Improve CMS Docs

The current packed employed to generate the CMS documentations does not work smoothly. For instance, it needs some error handling through out the development setup (see README):
...
The API can simply be accessed via the root url or /api.
In order to enter /docs successfully, it may be necessary to change the second line of the index.html file in .venv/lib64/python3.9/site-packages/rest_framework_swagger/templates/rest_framework_swagger from {% load staticfiles %} to {% load static %}
...

Furthermore, this project is no longer being maintained (https://github.com/marcgibbons/django-rest-swagger). Hence, it is import to find and implement a different solution.

PWA: track long term progress

If the user uses the PWA functionality, we can track the long term progress over many training sets.

Therefore:

  • If the PWA is installed, finishing a training set should store the result somewhere.
  • Users should have the option to view their progress in different training sets.
  • If the user is not using the PWA, this should at least also work in the current browser session.

Add an article for vocabs

We have received another suggestion for improvement. Do you have any suggestions how we could implement it?

"Ich möchte vorschlagen, die deutschen Substantive unbedingt um ihren bestimmten Artikel im Singular zu ergänzen. Artikel sind zwar für die meisten Lernenden eine – verständlicherweise – lästige Sache, aber eben auch die Realität. Im Sinne der Integration, die immer auch mit einer guten Sprachbeherrschung einhergeht, scheint mir notwendig, ihnen die Möglichkeit des korrekten Erlernens des Substantivs – also mit Artikel – zu ermöglichen. Fehlt der Artikel, wird der eifrige Lerner ihn extra nachschlagen müssen, der weniger eifrige Lernen wird sich mit dem Wort selbst begnügen, dann aber künftig ohne Artikel (oder mit falschem Artikel) sprechen, was sicher nicht im Sinne der Integration sein kann."

Use django-audiofield module

Use the django-audiofield module for managing and uploading sound files. If there is no way the iOS app supports .ogg, then we should convert all files to mp3, 44.1 kHz stereo.

django-image-cropping only rescales the picture instead of properly cropping it

Right now you are able to select only a part of the image of a Document in the admin back-end.
But the selected part is not shown when loading the image. However the scaling is changed according to the cropping attribute of the Document.

Instead of a distorted image the software should display the exact part which was chosen with the selection area in the back-end.

In my opinion the solution hides somewhere on this Github page:
https://github.com/jonasundderwolf/django-image-cropping

BUG: Submiting word via enter key is always wrong

  • If the input word is submitted via the enter key instead of the button "Überprüfen", it will always be considered wrong, even though it might be correct
  • Problem occured in the feature/pdf branch

Move strings into POT files

Move all strings that currently exist in Python, JavaScript and HTML files into a PO file to make them translatable. Translating content in Python and HTML templates is relatively easy. Django has a built in support for translations, which can also directly be used in templates.

Translations in JavaScript, if needed, are probably a little more tricky. There are 3 approaches:

  • Move all translateable content out of JavaScript files. This is probably a very sane approach.
  • Move some functions from static into rendered JS files and use the Django translation functions during rendering.
  • Make the .po files accessible and let JavaScript do the translations itself.

Documentation: https://docs.djangoproject.com/en/3.1/topics/i18n/translation/

Autofill word types and articles

Problem

  • If the user selects "noun" as word type, "none" should not be an option for the article field
  • if the user selects "verb" or "adjective" as word type, the article field should automatically be set to "none"

Support multiple correct words

Currently, only one word is correct. However, some items have multiple correct names. We should accept all possible names.

This requires changes to the model and API.

Improve fuzzy match for word input

Currently, there is only correct or wrong input. We want fuzzy matches, for example to catch typos. solved.

If the word "Glättkelle" is being asked for, we might accept "Glattkelle" as well. Or "glättkelle". solved.

We could introduce a new counter for "almost correct". That means words that have only a few wrong characters do not count as wrong but as "almost correct". solved.

If the user input is almost correct, we should not go to the next word immediately, but show the correct answer instead. Additionally, we could display a yellow glow around the input field in order signalize that the input was almost correct. solved.

Backend solution to standardize images

  • Try to find a backend solution to standardize the employed images
  • when an admin creates a new word and uploads the corresponding image, it should be automatically cropped into a quadratic format
  • eventually the admin should directly be able to modify the focus of how the image will be cropped

Add Icons Property

  • Icons should be delivered through the API
  • Add respective property for discipline and training set module

Read important settings from config ini file

If DEBUG = False, a standalone server should be used (MariaDB), with settings coming from an ini file residing at /etc/vocabulary-trainer/config.ini.

Additionally, the static and media paths should be adjustable. Default values should be /var/www/html/[static|media].

Displaying different word types

The app should also include verbs, adverbs etc. In order to do so, the backend should implement the following features:

  • add the possibility to upload numerous images
  • add a dropdown field for word type

Progressbar

  • Display progressbar during session
  • User should be able to see how many words he/she has already worked through during the current session

Rescale uploaded images

If an image is uploaded, it should be rescaled to either 1024px width or 768px width, whichever side is shorter. The file should be saved as PNG with max compression. Then the user needs to use the cropping dialog to fit a 1024x768 result.

Modify GUI

  • BUG _Confirm button for deleting objects should be in german (atm: "YES, I'M SURE)
    fixed in #106

  • modify actions-dropdown (deleting objects should be preselected), option: replace dropdown by buttons

Convert to progressive web app

The GUI is already a single page application. It should be quite easy to tell the browser that it is a PWA. There are very few static resources, like a few JS and CSS files. All content data is already coming from REST APIs, therefore this should not be an issue. We could enhance the functionality by caching all training sets offline (maybe including (scaled down) images?).

Fix migrations

Currently, there are 3 Migrations with the prefix 0007. That is 2 more than there should be. This leads to messages like CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0007_document_video_url, 0007_auto_20200921_1302, 0007_document_arcticle in vocgui).

Rename Django App

Instead of "visual-vocabulary-trainer" the project may be called "lunes-cms" (like the repo). The app "vocgui" could be renamed to "cms". This requires various hard code changes, e.g. in setup.py etc. Low priority.

Add new way to group single lessons

Currently vocabulary is grouped in sets. It would be more useful, if vocabulary would be grouped in lessons which belong to sets.
Otherwise single sets could become enormously big and a user would have to go through 30+ words in order to complete one round.

Improve foreignKey Assignment

Right now you can assign a foreignKey and a value via a drop down menu. This is very inaccessible especially with a big amount of vocabulary and topics.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.