Skip to content

Commit

Permalink
Merge pull request #546 from digitalfabrik/update_dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
sascha11110 authored Oct 30, 2024
2 parents 52055d9 + 82a9495 commit ed8777f
Show file tree
Hide file tree
Showing 42 changed files with 243 additions and 153 deletions.
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ orbs:
jobs:
install:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- restore_cache:
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
- lunes_cms.egg-info
compile-translations:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand All @@ -56,7 +56,7 @@ jobs:
- lunes_cms/locale/de/LC_MESSAGES/djangojs.mo
pylint:
docker:
- image: "cimg/python:3.9"
- image: "cimg/python:3.11"
steps:
- checkout
- attach_workspace:
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
- cc-test-reporter
test:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
environment:
LUNES_CMS_SECRET_KEY: circleci-dummy-key
- image: cimg/postgres:14.1
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
./cc-test-reporter sum-coverage -o - coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
black:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand All @@ -149,7 +149,7 @@ jobs:
black --check .
check-translations:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand All @@ -162,7 +162,7 @@ jobs:
command: ./tools/check_translations.sh
build-documentation:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand All @@ -172,7 +172,7 @@ jobs:
command: ./tools/build_documentation.sh
bump-dev-version:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand Down Expand Up @@ -217,7 +217,7 @@ jobs:
- lunes_cms/__init__.py
bump-version:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:
command: git checkout develop && git merge main --commit --no-edit && git push
build-package:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand All @@ -284,7 +284,7 @@ jobs:
- dist
publish-package:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand All @@ -296,7 +296,7 @@ jobs:
twine upload --non-interactive ./dist/lunes-cms-*.tar.gz
create-release:
docker:
- image: cimg/python:3.9
- image: cimg/python:3.11
steps:
- checkout
- attach_workspace:
Expand Down
6 changes: 3 additions & 3 deletions .circleci/scripts/create_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def main():
logo_url = "https://raw.githubusercontent.com/digitalfabrik/lunes-cms/c242f6b723da80e5d9f9ed7ca9c6f961bb095386/.github/logo.png"
compare_url = "https://github.com/digitalfabrik/lunes-cms/compare"
body = (
f"### ![]({logo_url}) lunes-cms `{args.tag}`"
f"\n\n### Changelog\n\n{args.changelog}\n\n"
f"Compare changes: [{args.prev_tag} {args.tag}]({compare_url}/{args.prev_tag}...{args.tag})"
f"### ![]({logo_url}) lunes-cms `{args.tag}`\n\n###"
f" Changelog\n\n{args.changelog}\n\nCompare changes: [{args.prev_tag}"
f" {args.tag}]({compare_url}/{args.prev_tag}...{args.tag})"
)

# Create release
Expand Down
3 changes: 2 additions & 1 deletion .circleci/scripts/get_access_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def main():
deliverino_private_key = os.environ["DELIVERINO_PRIVATE_KEY"]
except KeyError as e:
raise RuntimeError(
"Please make sure this step has access to the 'deliverino' CircleCI context."
"Please make sure this step has access to the 'deliverino' CircleCI"
" context."
) from e

# Generate payload for the JWT
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.9"
python: "3.11"
jobs:
pre_build:
- ./tools/build_documentation.sh
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ For more information please see our [GoVolunteer ad](https://translate.google.co

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
* `python3.11` 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:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Prerequisites
Followings are required before installing the project (install them with your manager):

* `git <https://git-scm.com/>`_
* `python3.8 <https://www.python.org/downloads/release/python-380/>`_ or higher
* `python3.11 <https://www.python.org/downloads/release/python-3110/>`_ or higher
* `python3-pip <https://packages.ubuntu.com/search?keywords=python3-pip>`_ (`Debian-based distributions <https://en.wikipedia.org/wiki/Category:Debian-based_distributions>`_, e.g. `Ubuntu <https://ubuntu.com>`__) / `python-pip <https://www.archlinux.de/packages/extra/x86_64/python-pip>`_ (`Arch-based distributions <https://wiki.archlinux.org/index.php/Arch-based_distributions>`_)
* `python3-venv <https://docs.python.org/3/library/venv.html>`__
* `libpq-dev <https://www.postgresql.org/docs/9.5/libpq.html>`__ to compile `psycopg2 <https://www.psycopg.org/docs/install.html#build-prerequisites>`__
Expand Down
2 changes: 1 addition & 1 deletion lunes_cms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This is the content management system for the vocabulary trainer app Lunes, whic

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

* python3.8 or greater
* python3.11 or greater
* python3-pip
* python3-venv
* ffmpeg
Expand Down
16 changes: 16 additions & 0 deletions lunes_cms/api/exception_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from rest_framework.views import exception_handler
from rest_framework import status


def custom_exception_handler(exc, context):
"""
Extend the default exception_handler of rest_framework.
Purpose: Simplify testing by ensuring that the detail message is the same for all 404 responses.
"""

response = exception_handler(exc, context)

if response.status_code == status.HTTP_404_NOT_FOUND:
response.data["detail"] = "Not found."

return response
10 changes: 6 additions & 4 deletions lunes_cms/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.core.exceptions import PermissionDenied
from django.db.models import Count, Q
from django.http import JsonResponse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from rest_framework import routers

Expand Down Expand Up @@ -181,9 +181,11 @@ def find_duplicates_for_word(request, word):
result = {
"message": _("This word is already registered in the system."),
"word": document_to_string(duplicate) + " (" + duplicate.word_type + ")",
"definition": _("Definition: ") + duplicate.definition
if duplicate.definition
else _("Definition: ") + _("No definition is provided for this word."),
"definition": (
_("Definition: ") + duplicate.definition
if duplicate.definition
else _("Definition: ") + _("No definition is provided for this word.")
),
"training_sets": _("Training sets: ") + training_sets_description,
}

Expand Down
5 changes: 3 additions & 2 deletions lunes_cms/api/v1/serializers/feedback_serializer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers

from ....cms.models import Feedback
Expand All @@ -19,7 +19,8 @@ class FeedbackSerializer(serializers.ModelSerializer):
),
error_messages={
"does_not_exist": _(
"The content type must be either 'discipline', 'training set' or 'document'."
"The content type must be either 'discipline', 'training set' or"
" 'document'."
),
},
)
Expand Down
6 changes: 4 additions & 2 deletions lunes_cms/api/v1/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
router = OptionalSlashRouter()
router.register(r"disciplines", views.DisciplineViewSet, "disciplines")
router.register(
"disciplines_by_level/",
"disciplines_by_level",
views.DisciplineFilteredViewSet,
"disciplines_overview",
)
Expand All @@ -41,7 +41,9 @@
)

router.register(
r"document_by_id/(?P<document_id>[0-9]+)", views.DocumentByIdViewSet, "documents"
r"document_by_id/(?P<document_id>[0-9]+)",
views.DocumentByIdViewSet,
"document_by_id",
)
router.register(r"words", views.WordViewSet, "words")
router.register(r"group_info", views.GroupViewSet, "group_by_id")
Expand Down
2 changes: 1 addition & 1 deletion lunes_cms/cms/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import absolute_import, unicode_literals

from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from .admins import (
DisciplineAdmin,
Expand Down
2 changes: 1 addition & 1 deletion lunes_cms/cms/admins/discipline_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.http import HttpResponse
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from mptt.admin import DraggableMPTTAdmin
from tablib import Dataset

Expand Down
2 changes: 1 addition & 1 deletion lunes_cms/cms/admins/document_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.contrib import admin
from django.db.models import Case, Exists, IntegerField, OuterRef, Value, When
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from ..list_filter import (
ApprovedImageListFilter,
Expand Down
13 changes: 11 additions & 2 deletions lunes_cms/cms/admins/document_resource.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from import_export import fields, resources
from import_export.admin import ExportActionMixin

Expand Down Expand Up @@ -103,4 +103,13 @@ class Meta:
"""

model = Document
fields = ()
fields = (
"word",
"word_type",
"singular_article",
"plural_article",
"has_audio",
"example_sentence",
"creation_date",
"training_sets",
)
2 changes: 1 addition & 1 deletion lunes_cms/cms/admins/sponsor_admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from ..utils import get_image_tag

Expand Down
8 changes: 5 additions & 3 deletions lunes_cms/cms/admins/training_set_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ngettext
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from mptt.admin import DraggableMPTTAdmin

from ..forms import TrainingSetForm
Expand Down Expand Up @@ -217,8 +217,10 @@ def make_released(self, request, queryset):
messages.error(
request,
ngettext(
"The training set {} could not be released because it contains less than {} vocabulary words with confirmed images.",
"The training sets {} could not be released because they contain less than {} vocabulary words with confirmed images.",
"The training set {} could not be released because it contains less"
" than {} vocabulary words with confirmed images.",
"The training sets {} could not be released because they contain"
" less than {} vocabulary words with confirmed images.",
len(invalid_trainingsets),
).format(
iter_to_string(invalid_trainingsets),
Expand Down
2 changes: 1 addition & 1 deletion lunes_cms/cms/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class CmsConfig(AppConfig):
Expand Down
9 changes: 6 additions & 3 deletions lunes_cms/cms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.conf import settings
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from .models import Discipline, Document, TrainingSet
from .widgets import ManyToManyOverlay
Expand Down Expand Up @@ -52,7 +52,9 @@ class Meta:
widget=ManyToManyOverlay(verbose_name=(_("vocabulary")), is_stacked=False),
label=_("vocabulary"),
help_text=_(
"Please select some vocabularies for your training set. To see a preview of the corresponding image and audio files, press the alt key while selecting."
"Please select some vocabularies for your training set. To see a preview of"
" the corresponding image and audio files, press the alt key while"
" selecting."
),
)

Expand All @@ -74,7 +76,8 @@ def clean(self):
self.add_error(
"released",
_(
"You can only release a training set that contains at least {} vocabulary words with confirmed images."
"You can only release a training set that contains at least {}"
" vocabulary words with confirmed images."
).format(settings.TRAININGSET_MIN_DOCS),
)
return cleaned_data
2 changes: 1 addition & 1 deletion lunes_cms/cms/list_filter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin
from django.db.models import F
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from .models import Discipline, TrainingSet

Expand Down
Loading

0 comments on commit ed8777f

Please sign in to comment.