Skip to content

Commit

Permalink
upgrade to django 4.2
Browse files Browse the repository at this point in the history
updated to 4.2 in the PIPFILE.LOCK

updated model

added global default id

I rely far too heavily on auto formatting
  • Loading branch information
Tllew committed Jan 4, 2024
1 parent 0291b8d commit 9974765
Show file tree
Hide file tree
Showing 7 changed files with 476 additions and 390 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ mailserver/*

# pii file
.pii-secret-hook
.background-tasks-is-ready
7 changes: 3 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pytest-cov = "*"
requests-mock = "*"

[packages]
djangorestframework = "~=3.9"
django-background-tasks = "~=1.2"
djangorestframework = "~=3.14.0"
django4-background-tasks = "~=1.2.9"
django-environ = "~=0.4"
django-model-utils = "~=4.0"
sentry-sdk = "~=1.17.0"
Expand All @@ -30,9 +30,8 @@ requests = "~=2.31"
unidecode = "~=1.2"
django-log-formatter-ecs = "==0.0.5"
gunicorn = "*"
django = "==3.2.23"
django = "~=4.2.8"
elastic-apm = "==6.7.2"
django-jsonfield = "==1.4"
msal = "~=1.22.0"
psycopg2-binary = "~=2.9.3"
setuptools = "~=65.5.1"
Expand Down
803 changes: 433 additions & 370 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DEBUG", default=False)

ALLOWED_HOSTS = "*"
ALLOWED_HOSTS = ["*"]


# Application definition
Expand Down Expand Up @@ -255,3 +255,5 @@
AZURE_AUTH_TENANT_ID = env.str("AZURE_AUTH_TENANT_ID")

SEND_REJECTED_EMAIL = env.bool("SEND_REJECTED_EMAIL", default=True)

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
25 changes: 12 additions & 13 deletions mail/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import django.db.models.deletion
import django.utils.timezone
import jsonfield.fields
from django.db import migrations, models


Expand Down Expand Up @@ -85,20 +84,20 @@ class Migration(migrations.Migration):
name="UsageUpdate",
fields=[
("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
("licence_ids", jsonfield.fields.JSONField(default=dict)),
("licence_ids", models.JSONField(default=dict)),
("spire_run_number", models.IntegerField()),
("hmrc_run_number", models.IntegerField()),
("has_lite_data", models.NullBooleanField(default=None)),
("has_spire_data", models.NullBooleanField(default=None)),
("lite_payload", jsonfield.fields.JSONField(default=dict)),
("has_lite_data", models.BooleanField(null=True)),
("has_spire_data", models.BooleanField(null=True)),
("lite_payload", models.JSONField(default=dict)),
("lite_sent_at", models.DateTimeField(blank=True, null=True)),
("lite_accepted_licences", jsonfield.fields.JSONField(default=dict)),
("lite_rejected_licences", jsonfield.fields.JSONField(default=dict)),
("spire_accepted_licences", jsonfield.fields.JSONField(default=dict)),
("spire_rejected_licences", jsonfield.fields.JSONField(default=dict)),
("lite_licences", jsonfield.fields.JSONField(default=dict)),
("spire_licences", jsonfield.fields.JSONField(default=dict)),
("lite_response", jsonfield.fields.JSONField(default=dict)),
("lite_accepted_licences", models.JSONField(default=dict)),
("lite_rejected_licences", models.JSONField(default=dict)),
("spire_accepted_licences", models.JSONField(default=dict)),
("spire_rejected_licences", models.JSONField(default=dict)),
("lite_licences", models.JSONField(default=dict)),
("spire_licences", models.JSONField(default=dict)),
("lite_response", models.JSONField(default=dict)),
("mail", models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to="mail.Mail")),
],
options={
Expand Down Expand Up @@ -134,7 +133,7 @@ class Migration(migrations.Migration):
choices=[("insert", "Insert"), ("cancel", "Cancel"), ("update", "Update")], max_length=6
),
),
("data", jsonfield.fields.JSONField(default=dict)),
("data", models.JSONField(default=dict)),
("received_at", models.DateTimeField(default=django.utils.timezone.now)),
("is_processed", models.BooleanField(default=False)),
("old_lite_id", models.UUIDField(null=True)),
Expand Down
22 changes: 22 additions & 0 deletions mail/migrations/0022_alter_licencedata_licence_payloads.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 4.2.9 on 2024-01-04 14:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("mail", "0021_licencepayload_skip_process"),
]

operations = [
migrations.AlterField(
model_name="licencedata",
name="licence_payloads",
field=models.ManyToManyField(
help_text="LicencePayload records linked to this LicenceData instance",
related_name="+",
to="mail.licencepayload",
),
),
]
4 changes: 2 additions & 2 deletions mail/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class UsageData(models.Model):
mail = models.ForeignKey(Mail, on_delete=models.DO_NOTHING, null=False)
spire_run_number = models.IntegerField()
hmrc_run_number = models.IntegerField()
has_lite_data = models.NullBooleanField(default=None)
has_spire_data = models.NullBooleanField(default=None)
has_lite_data = models.BooleanField(null=True)
has_spire_data = models.BooleanField(null=True)
lite_payload = models.JSONField(default=dict)
lite_sent_at = models.DateTimeField(blank=True, null=True) # When update was sent to LITE API
lite_accepted_licences = models.JSONField(default=list)
Expand Down

0 comments on commit 9974765

Please sign in to comment.