Skip to content

Commit

Permalink
Merge pull request #415 from UKGovernmentBEIS/PC-1294-update-django-v…
Browse files Browse the repository at this point in the history
…ersion

PC-1294: Update Django version
  • Loading branch information
samyou-softwire authored Dec 20, 2024
2 parents 1cfb516 + 42bd80e commit f87d8a3
Show file tree
Hide file tree
Showing 4 changed files with 356 additions and 323 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import datetime
from datetime import datetime, timezone

import pytz
from dateutil.relativedelta import relativedelta

from help_to_heat import portal
Expand All @@ -27,10 +26,10 @@ def _try_find_most_recent_duplicate_referral_within_range(self, recent_interval_
uprn = session_data.get(uprn_field)
if not uprn:
return None
recent_cutoff_date = datetime.utcnow() + relativedelta(months=-recent_interval_months)
recent_cutoff_date = datetime.now(timezone.utc) + relativedelta(months=-recent_interval_months)
duplicate_referrals = (
portal.models.Referral.objects.filter(data__uprn=uprn)
.filter(created_at__gte=recent_cutoff_date.astimezone(pytz.UTC))
.filter(created_at__gte=recent_cutoff_date.astimezone(timezone.utc))
.order_by("-created_at")
)
if len(duplicate_referrals) == 0:
Expand Down
2 changes: 1 addition & 1 deletion help_to_heat/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"allauth.account.middleware.AccountMiddleware",
"help_to_heat.middleware.RequestLoggingMiddleware", # at the bottom to only log requests that aren't blocked
]

Expand Down Expand Up @@ -185,7 +186,6 @@ def show_toolbar(request):
LANGUAGE_CODE = "en-gb"
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True

LOCALE_PATHS = [
Expand Down
Loading

0 comments on commit f87d8a3

Please sign in to comment.