Skip to content

Commit

Permalink
feat: add django-jet admin
Browse files Browse the repository at this point in the history
  • Loading branch information
ngurenyaga committed Jul 14, 2021
1 parent 431c162 commit f8562bf
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 120 deletions.
225 changes: 112 additions & 113 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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
}
12 changes: 8 additions & 4 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -78,7 +82,6 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.humanize",
"django.contrib.admin",
"django.forms",
]
THIRD_PARTY_APPS = [
Expand All @@ -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 = [
Expand Down Expand Up @@ -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
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -315,6 +320,5 @@
# Your stuff...
# ------------------------------------------------------------------------------
DECIMAL_PLACES = 4

MAX_IMAGE_HEIGHT = 4320
MAX_IMAGE_WIDTH = 7680
5 changes: 4 additions & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
5 changes: 3 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit f8562bf

Please sign in to comment.