Skip to content

Commit

Permalink
Adds back in django admin and auth functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbarnes committed Sep 11, 2024
1 parent 0df11bf commit caf390b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 36 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ django-shell-local: # Run a Django shell (local django instance)
DJANGO_SETTINGS_MODULE=config.settings.local \
poetry run python orp/manage.py shell

migrate: # Run Django migrate
docker compose run --rm web poetry run python orp/manage.py migrate --noinput

migrations: # Run Django makemigrations
docker compose run --rm web poetry run python orp/manage.py makemigrations --noinput

lint: # Run all linting
make black
make isort
Expand Down
2 changes: 1 addition & 1 deletion local.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Django Settings
ALLOWED_HOSTS=localhost
DEBUG=True
DJANGO_ADMIN=False
DJANGO_ADMIN=True
DJANGO_SETTINGS_MODULE=config.settings.local
DJANGO_SECRET_KEY=orp-secret

Expand Down
50 changes: 22 additions & 28 deletions orp/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@

# Application definition
DJANGO_APPS = [
# "django.contrib.admin",
# "django.contrib.auth",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
Expand All @@ -70,7 +70,7 @@
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
# "django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
Expand All @@ -90,19 +90,13 @@
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
# "django.contrib.auth.context_processors.auth",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]

# TODO: Add auth backends?
# AUTHENTICATION_BACKENDS = [
# "config.backends.CustomAxesBackend",
# "django.contrib.auth.backends.ModelBackend",
# ]

WSGI_APPLICATION = "config.wsgi.application"

DATABASES: dict = {}
Expand All @@ -125,20 +119,20 @@
}
}

# AUTH_PASSWORD_VALIDATORS = [
# {
# "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", # noqa: E501
# },
# {
# "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", # noqa: E501
# },
# {
# "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", # noqa: E501
# },
# {
# "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", # noqa: E501
# },
# ]
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", # noqa: E501
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", # noqa: E501
},
{
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", # noqa: E501
},
{
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", # noqa: E501
},
]

# Internationalisation
LANGUAGE_CODE = "en-gb"
Expand Down Expand Up @@ -250,12 +244,12 @@
# )

# Pagination
RESULTS_PER_PAGE = 10
# RESULTS_PER_PAGE = 10

# GOV Notify
GOV_NOTIFY_API_KEY = env.str("GOV_NOTIFY_API_KEY", default=None)
GOV_NOTIFY_TESTING_KEY = env.str("GOV_NOTIFY_TESTING_KEY", default=None)
DISABLE_NOTIFY_WHITELIST = env.bool("DISABLE_NOTIFY_WHITELIST", default=False)
# GOV_NOTIFY_API_KEY = env.str("GOV_NOTIFY_API_KEY", default=None)
# GOV_NOTIFY_TESTING_KEY = env.str("GOV_NOTIFY_TESTING_KEY", default=None)
# DISABLE_NOTIFY_WHITELIST = env.bool("DISABLE_NOTIFY_WHITELIST", default=False) # noqa: E501

# HOSTNAME
HOSTNAME_MAP = {
Expand Down
10 changes: 3 additions & 7 deletions orp/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# from django.contrib import admin

# from core.models import Confirmation, ContractDetail, Report

# admin.site.register(Confirmation)
# admin.site.register(ContractDetail)
# admin.site.register(Report)
"""
TODO: Register models when available
"""

0 comments on commit caf390b

Please sign in to comment.