Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1013 from uktrade/chore/bump-django-to-5.0.8
Browse files Browse the repository at this point in the history
Compatibility changes required to bump Django to 5.0.x
  • Loading branch information
oliverjwroberts authored Aug 12, 2024
2 parents 6bfcd5e + 69d66f2 commit 460de94
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/enquiries/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class OwnerAdmin(admin.ModelAdmin):
list_display = all_fields_of(Owner, ("password",))


@admin.display(
description="Enquirer",
)
def enquirer(obj):
return f"{obj.enquirer.first_name} {obj.enquirer.last_name}"


enquirer.short_description = "Enquirer"


@admin.register(Enquiry)
class EnquiryAdmin(admin.ModelAdmin):
list_display = ("owner", enquirer, "region", "country", "enquiry_stage",
Expand Down
8 changes: 4 additions & 4 deletions app/enquiries/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def authenticate(self, request):
If we cannot authenticate, AuthenticationFailed is raised, as required
in the DRF authentication flow
"""
if "HTTP_AUTHORIZATION" not in request.META:
if "authorization" not in request.headers:
raise AuthenticationFailed(NO_CREDENTIALS_MESSAGE)

try:
Expand Down Expand Up @@ -128,7 +128,7 @@ def _authorise(request):
"""Raises a HawkFail if the passed request cannot be authenticated"""
return Receiver(
_lookup_credentials,
request.META["HTTP_AUTHORIZATION"],
request.headers["authorization"],
request.build_absolute_uri(),
request.method,
content=request.body,
Expand Down Expand Up @@ -180,12 +180,12 @@ def authenticate(self, request):
logger.warning("PaaS IP check authentication is disabled.")
return None

if "HTTP_X_FORWARDED_FOR" not in request.META:
if "x-forwarded-for" not in request.headers:
# We assume that absence of the header indicates connection originating
# in the internal network
return None

x_forwarded_for = request.META["HTTP_X_FORWARDED_FOR"]
x_forwarded_for = request.headers["x-forwarded-for"]
ip_addresses = x_forwarded_for.split(",")

if len(ip_addresses) < settings.AUTH_PAAS_ADDED_X_FORWARDED_FOR_IPS:
Expand Down
3 changes: 1 addition & 2 deletions app/enquiries/migrations/0005_auto_20200323_1901.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
from django.utils.timezone import utc


class Migration(migrations.Migration):
Expand Down Expand Up @@ -89,7 +88,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='owner',
name='username',
field=models.CharField(default=datetime.datetime(2020, 3, 23, 19, 1, 33, 723242, tzinfo=utc), error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username'),
field=models.CharField(default=datetime.datetime(2020, 3, 23, 19, 1, 33, 723242, tzinfo=datetime.timezone.utc), error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username'),
preserve_default=False,
),
]
1 change: 0 additions & 1 deletion app/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True

Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
app:
build: .
Expand Down

0 comments on commit 460de94

Please sign in to comment.