diff --git a/requirements/base.in b/requirements/base.in index 9491acfd..b46de3f4 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -1,7 +1,5 @@ # Core python libraries -Pillow # handle images psycopg2 # database driver -pytz # handle timezones python-dotenv # environment variables for secrets python-decouple # processing of envvar configs jsonschema @@ -10,12 +8,8 @@ jsonschema django django-admin-index django-axes -django-choices -django-hijack django-jsonsuit django-redis -django-rosetta -django-sniplates maykin-django-two-factor-auth maykin-django-two-factor-auth[phonenumbers] mozilla-django-oidc-db @@ -23,7 +17,6 @@ sharing-configs # API libraries djangorestframework -# django-extra-fields django-filter drf-nested-routers drf-spectacular diff --git a/requirements/base.txt b/requirements/base.txt index e5ba0be9..8e6ed581 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -67,7 +67,6 @@ django==3.2.20 # django-choices # django-filter # django-formtools - # django-hijack # django-jsonsuit # django-otp # django-phonenumber-field @@ -75,9 +74,7 @@ django==3.2.20 # django-redis # django-relativedelta # django-rest-framework-condition - # django-rosetta # django-simple-certmanager - # django-sniplates # django-solo # djangorestframework # drf-nested-routers @@ -96,17 +93,13 @@ django-axes==6.0.1 django-better-admin-arrayfield==1.4.2 # via mozilla-django-oidc-db django-choices==1.7.2 - # via - # -r requirements/base.in - # commonground-api-common + # via commonground-api-common django-filter==23.2 # via # -r requirements/base.in # commonground-api-common django-formtools==2.4.1 # via maykin-django-two-factor-auth -django-hijack==3.3.0 - # via -r requirements/base.in django-jsonsuit==0.5.0 # via -r requirements/base.in django-ordered-model==3.7.4 @@ -123,14 +116,10 @@ django-relativedelta==2.0.0 # via zgw-consumers django-rest-framework-condition==0.1.1 # via commonground-api-common -django-rosetta==0.9.9 - # via -r requirements/base.in django-sendfile2==0.7.0 # via django-privates django-simple-certmanager==1.3.0 # via zgw-consumers -django-sniplates==0.7.1 - # via -r requirements/base.in django-solo==2.0.0 # via # commonground-api-common @@ -209,10 +198,6 @@ packaging==23.1 # via drf-yasg phonenumbers==8.13.11 # via maykin-django-two-factor-auth -pillow==9.5.0 - # via -r requirements/base.in -polib==1.2.0 - # via django-rosetta prompt-toolkit==3.0.38 # via click-repl psycopg2==2.9.6 @@ -240,7 +225,6 @@ python-dotenv==1.0.0 # via -r requirements/base.in pytz==2023.3 # via - # -r requirements/base.in # celery # django # drf-yasg @@ -258,7 +242,6 @@ requests==2.31.0 # via # commonground-api-common # coreapi - # django-rosetta # gemma-zds-client # mozilla-django-oidc # requests-mock diff --git a/requirements/ci.txt b/requirements/ci.txt index 456b6a14..eac09e1f 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -101,7 +101,6 @@ django==3.2.20 # django-choices # django-filter # django-formtools - # django-hijack # django-jenkins # django-jsonsuit # django-otp @@ -110,10 +109,8 @@ django==3.2.20 # django-redis # django-relativedelta # django-rest-framework-condition - # django-rosetta # django-sendfile2 # django-simple-certmanager - # django-sniplates # django-solo # djangorestframework # drf-nested-routers @@ -145,8 +142,6 @@ django-formtools==2.4.1 # via # -r requirements/base.txt # maykin-django-two-factor-auth -django-hijack==3.3.0 - # via -r requirements/base.txt django-jenkins==0.110.0 # via -r requirements/test-tools.in django-jsonsuit==0.5.0 @@ -177,8 +172,6 @@ django-rest-framework-condition==0.1.1 # via # -r requirements/base.txt # commonground-api-common -django-rosetta==0.9.9 - # via -r requirements/base.txt django-sendfile2==0.7.0 # via # -r requirements/base.txt @@ -187,8 +180,6 @@ django-simple-certmanager==1.3.0 # via # -r requirements/base.txt # zgw-consumers -django-sniplates==0.7.1 - # via -r requirements/base.txt django-solo==2.0.0 # via # -r requirements/base.txt @@ -314,12 +305,6 @@ phonenumbers==8.13.11 # via # -r requirements/base.txt # maykin-django-two-factor-auth -pillow==9.5.0 - # via -r requirements/base.txt -polib==1.2.0 - # via - # -r requirements/base.txt - # django-rosetta prompt-toolkit==3.0.38 # via # -r requirements/base.txt @@ -383,7 +368,6 @@ requests==2.31.0 # -r requirements/base.txt # commonground-api-common # coreapi - # django-rosetta # gemma-zds-client # mozilla-django-oidc # requests-mock diff --git a/requirements/dev.txt b/requirements/dev.txt index 5f0e41af..14e38eb2 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -121,7 +121,6 @@ django==3.2.20 # django-extensions # django-filter # django-formtools - # django-hijack # django-jenkins # django-jsonsuit # django-otp @@ -130,10 +129,8 @@ django==3.2.20 # django-redis # django-relativedelta # django-rest-framework-condition - # django-rosetta # django-sendfile2 # django-simple-certmanager - # django-sniplates # django-solo # djangorestframework # drf-nested-routers @@ -169,8 +166,6 @@ django-formtools==2.4.1 # via # -r requirements/ci.txt # maykin-django-two-factor-auth -django-hijack==3.3.0 - # via -r requirements/ci.txt django-jenkins==0.110.0 # via -r requirements/ci.txt django-jsonsuit==0.5.0 @@ -201,8 +196,6 @@ django-rest-framework-condition==0.1.1 # via # -r requirements/ci.txt # commonground-api-common -django-rosetta==0.9.9 - # via -r requirements/ci.txt django-sendfile2==0.7.0 # via # -r requirements/ci.txt @@ -211,8 +204,6 @@ django-simple-certmanager==1.3.0 # via # -r requirements/ci.txt # zgw-consumers -django-sniplates==0.7.1 - # via -r requirements/ci.txt django-solo==2.0.0 # via # -r requirements/ci.txt @@ -362,16 +353,10 @@ phonenumbers==8.13.11 # via # -r requirements/ci.txt # maykin-django-two-factor-auth -pillow==9.5.0 - # via -r requirements/ci.txt pip-tools==6.13.0 # via -r requirements/dev.in platformdirs==3.5.1 # via black -polib==1.2.0 - # via - # -r requirements/ci.txt - # django-rosetta prompt-toolkit==3.0.38 # via # -r requirements/ci.txt @@ -443,7 +428,6 @@ requests==2.31.0 # -r requirements/ci.txt # commonground-api-common # coreapi - # django-rosetta # gemma-zds-client # mozilla-django-oidc # requests-mock diff --git a/src/objecttypes/conf/base.py b/src/objecttypes/conf/base.py index 1a776072..64d8d784 100644 --- a/src/objecttypes/conf/base.py +++ b/src/objecttypes/conf/base.py @@ -1,6 +1,5 @@ import os -# Django-hijack (and Django-hijack-admin) from django.urls import reverse_lazy from sentry_sdk.integrations import django, redis @@ -70,9 +69,6 @@ "axes", "django_better_admin_arrayfield", "jsonsuit.apps.JSONSuitConfig", - "sniplates", - "hijack", - "hijack.contrib.admin", "mozilla_django_oidc", "mozilla_django_oidc_db", "rest_framework", @@ -104,7 +100,6 @@ "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "axes.middleware.AxesMiddleware", - "hijack.middleware.HijackUserMiddleware", "django_otp.middleware.OTPMiddleware", ] @@ -359,15 +354,6 @@ "REMOTE_ADDR", ) -# Django-Hijack -HIJACK_LOGIN_REDIRECT_URL = "/" -HIJACK_LOGOUT_REDIRECT_URL = reverse_lazy("admin:accounts_user_changelist") -# The Admin mixin is used because we use a custom User-model. -HIJACK_REGISTER_ADMIN = False -# This is a CSRF-security risk. -# See: http://django-hijack.readthedocs.io/en/latest/configuration/#allowing-get-method-for-hijack-views -HIJACK_ALLOW_GET_REQUESTS = True - # Sentry SDK SENTRY_DSN = config("SENTRY_DSN", None) diff --git a/src/objecttypes/core/constants.py b/src/objecttypes/core/constants.py index a77fbe20..04bc7067 100644 --- a/src/objecttypes/core/constants.py +++ b/src/objecttypes/core/constants.py @@ -1,28 +1,25 @@ +from django.db import models from django.utils.translation import ugettext_lazy as _ -from djchoices import ChoiceItem, DjangoChoices +class ObjectVersionStatus(models.TextChoices): + published = "published", _("Published") + draft = "draft", _("Draft") + deprecated = "deprecated", _("Deprecated") -class ObjectVersionStatus(DjangoChoices): - published = ChoiceItem("published", _("Published")) - draft = ChoiceItem("draft", _("Draft")) - deprecated = ChoiceItem("deprecated", _("Deprecated")) +class DataClassificationChoices(models.TextChoices): + open = "open", _("Open") + intern = "intern", _("Intern") + confidential = "confidential", _("Confidential") + strictly_confidential = "strictly_confidential", _("Strictly confidential") -class DataClassificationChoices(DjangoChoices): - open = ChoiceItem("open", _("Open")) - intern = ChoiceItem("intern", _("Intern")) - confidential = ChoiceItem("confidential", _("Confidential")) - strictly_confidential = ChoiceItem( - "strictly_confidential", _("Strictly confidential") - ) - -class UpdateFrequencyChoices(DjangoChoices): - real_time = ChoiceItem("real_time", _("Real-time")) - hourly = ChoiceItem("hourly", _("Hourly")) - daily = ChoiceItem("daily", _("Daily")) - weekly = ChoiceItem("weekly", _("Weekly")) - monthly = ChoiceItem("monthly", _("Monthly")) - yearly = ChoiceItem("yearly", _("Yearly")) - unknown = ChoiceItem("unknown", _("Unknown")) +class UpdateFrequencyChoices(models.TextChoices): + real_time = "real_time", _("Real-time") + hourly = "hourly", _("Hourly") + daily = "daily", _("Daily") + weekly = "weekly", _("Weekly") + monthly = "monthly", _("Monthly") + yearly = "yearly", _("Yearly") + unknown = "unknown", _("Unknown") diff --git a/src/objecttypes/urls.py b/src/objecttypes/urls.py index c26a583c..b02f064d 100644 --- a/src/objecttypes/urls.py +++ b/src/objecttypes/urls.py @@ -25,7 +25,6 @@ auth_views.PasswordResetDoneView.as_view(), name="password_reset_done", ), - path("admin/hijack/", include("hijack.urls")), path("admin/", admin.site.urls), path( "reset///",