From f8562bf272e33d4e580a658bb7f4a75e1af128f0 Mon Sep 17 00:00:00 2001 From: Ngure Nyaga Date: Wed, 14 Jul 2021 17:25:57 +0300 Subject: [PATCH] feat: add django-jet admin --- .vscode/settings.json | 225 ++++++++++++++++++++-------------------- config/settings/base.py | 12 ++- config/urls.py | 5 +- requirements/base.txt | 5 +- 4 files changed, 127 insertions(+), 120 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7759da29..b0746299 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,115 +1,114 @@ { - "cSpell.words": [ - "action", - "analyze", - "baringo", - "bomet", - "bouvet", - "buildkit", - "bungoma", - "busia", - "cabo", - "check", - "codeql", - "cunha", - "cura", - "d'ivoire", - "darussalam", - "docker", - "e", - "elgeyo", - "embu", - "eustatius", - "ex", - "fahari", - "faso", - "forwarded", - "gaierror", - "garissa", - "gcloud", - "gethostbyname", - "gishu", - "github", - "grappelli", - "homa", - "http", - "isiolo", - "isready", - "itertools", - "jamii", - "jpetrucciani", - "jsmin", - "kajiado", - "kericho", - "kiambu", - "kilifi", - "kisii", - "kitts", - "kitui", - "kwale", - "laikipia", - "lamu", - "lemy", - "leste", - "maarten", - "machakos", - "makueni", - "mandera", - "marakwet", - "marino", - "marsabit", - "master", - "mayen", - "meru", - "migori", - "mle", - "murang", - "murang'a", - "muranga", - "mypy", - "nakuru", - "nandi", - "narok", - "nithi", - "noinput", - "noqa", - "nostatic", - "nyamira", - "nyandarua", - "nyeri", - "nzoia", - "organisation", - "organisations", - "pepfar", - "pg", - "phne", - "plurinational", - "pokot", - "postgres", - "proto", - "pytest", - "pytestmark", - "rica", - "runserver", - "samburu", - "savannahghi", - "siaya", - "sint", - "spreadsheetml", - "taita", - "taveta", - "tokelau", - "u", - "uasin", - "v", - "viet", - "vihiga", - "wajir", - "wordprocessingml", - "x", - "zfill" - ], - "python.linting.pylintEnabled": true, - "python.formatting.provider": "black", - "python.linting.enabled": true + "cSpell.words": [ + "action", + "analyze", + "baringo", + "bomet", + "bouvet", + "buildkit", + "bungoma", + "busia", + "cabo", + "check", + "codeql", + "cunha", + "cura", + "d'ivoire", + "darussalam", + "docker", + "e", + "elgeyo", + "embu", + "eustatius", + "ex", + "fahari", + "faso", + "forwarded", + "gaierror", + "garissa", + "gcloud", + "gethostbyname", + "gishu", + "github", + "homa", + "http", + "isiolo", + "isready", + "itertools", + "jamii", + "jpetrucciani", + "jsmin", + "kajiado", + "kericho", + "kiambu", + "kilifi", + "kisii", + "kitts", + "kitui", + "kwale", + "laikipia", + "lamu", + "lemy", + "leste", + "maarten", + "machakos", + "makueni", + "mandera", + "marakwet", + "marino", + "marsabit", + "master", + "mayen", + "meru", + "migori", + "mle", + "murang", + "murang'a", + "muranga", + "mypy", + "nakuru", + "nandi", + "narok", + "nithi", + "noinput", + "noqa", + "nostatic", + "nyamira", + "nyandarua", + "nyeri", + "nzoia", + "organisation", + "organisations", + "pepfar", + "pg", + "phne", + "plurinational", + "pokot", + "postgres", + "proto", + "pytest", + "pytestmark", + "rica", + "runserver", + "samburu", + "savannahghi", + "siaya", + "sint", + "spreadsheetml", + "taita", + "taveta", + "tokelau", + "u", + "uasin", + "v", + "viet", + "vihiga", + "wajir", + "wordprocessingml", + "x", + "zfill" + ], + "python.linting.pylintEnabled": true, + "python.formatting.provider": "black", + "python.linting.enabled": true } diff --git a/config/settings/base.py b/config/settings/base.py index 31c66910..b0b50638 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -68,6 +68,10 @@ # https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application WSGI_APPLICATION = "config.wsgi.application" +# BigAutoField needs migration of existing data and either changes to +# dependencies or overriding dependencies +DEFAULT_AUTO_FIELD = "django.db.models.AutoField" + # APPS # ------------------------------------------------------------------------------ DJANGO_APPS = [ @@ -78,7 +82,6 @@ "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.humanize", - "django.contrib.admin", "django.forms", ] THIRD_PARTY_APPS = [ @@ -89,7 +92,9 @@ "rest_framework", "rest_framework.authtoken", "corsheaders", - "grappelli", + # "jet.dashboard", + "jet", + "django.contrib.admin", # needs to come after jet so that jet static files are preferred ] LOCAL_APPS = [ @@ -232,7 +237,7 @@ # https://docs.djangoproject.com/en/dev/ref/settings/#secure-browser-xss-filter SECURE_BROWSER_XSS_FILTER = True # https://docs.djangoproject.com/en/dev/ref/settings/#x-frame-options -X_FRAME_OPTIONS = "DENY" +X_FRAME_OPTIONS = "SAMEORIGIN" # needs to be SAMEORIGIN for the jet admin to work # EMAIL # ------------------------------------------------------------------------------ @@ -315,6 +320,5 @@ # Your stuff... # ------------------------------------------------------------------------------ DECIMAL_PLACES = 4 - MAX_IMAGE_HEIGHT = 4320 MAX_IMAGE_WIDTH = 7680 diff --git a/config/urls.py b/config/urls.py index e5b33df1..cd24888d 100644 --- a/config/urls.py +++ b/config/urls.py @@ -15,9 +15,12 @@ TemplateView.as_view(template_name="pages/about.html"), name="about", ), + # path( + # "jet/dashboard/", include("jet.dashboard.urls", "jet-dashboard") + # ), # Django JET dashboard URLS + path("jet/", include("jet.urls", "jet")), # Django JET URLS # Django Admin, use {% url 'admin:index' %} path(settings.ADMIN_URL, admin.site.urls), - path("grappelli/", include("grappelli.urls")), # grappelli URLS # User management path("users/", include("pepfar_mle.users.urls", namespace="users")), path("accounts/", include("allauth.urls")), diff --git a/requirements/base.txt b/requirements/base.txt index c3fd8b3f..24eab906 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -11,10 +11,12 @@ phonenumbers~=8.12.26 Fraction~=1.5.1 coveralls~=3.1.0 google-cloud-secret-manager~=2.5.0 +cifrazia-django-jet~=1.1.4 +google-api-python-client~=2.13.0 # Django # ------------------------------------------------------------------------------ -django~=3.1.12 # pyup: < 3.2 # https://www.djangoproject.com/ +django~=3.2.5 # pyup: < 3.2 # https://www.djangoproject.com/ django-environ~=0.4.5 # https://github.com/joke2k/django-environ django-model-utils~=4.1.1 # https://github.com/jazzband/django-model-utils django-allauth~=0.44.0 # https://github.com/pennersr/django-allauth @@ -25,4 +27,3 @@ djangorestframework~=3.12.4 # https://github.com/encode/django-rest-framework django-cors-headers~=3.7.0 # https://github.com/adamchainz/django-cors-headers django-storages[google]~=1.11.1 # https://github.com/jschneier/django-storages django-anymail[mailgun]~=8.4 # https://github.com/anymail/django-anymail -django-grappelli~=2.15.1