Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PC-1294: Update Django version #415

Merged
merged 5 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading