Skip to content

Commit

Permalink
Simplify organisation model and remake migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
maxf committed Mar 13, 2024
1 parent 198d6f2 commit 5597558
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 123 deletions.
73 changes: 32 additions & 41 deletions request_a_govuk_domain/request/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.10 on 2024-03-08 18:51
# Generated by Django 4.2.11 on 2024-03-13 16:04

from django.conf import settings
from django.db import migrations, models
Expand All @@ -8,6 +8,7 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down Expand Up @@ -39,21 +40,6 @@ class Migration(migrations.Migration):
),
],
),
migrations.CreateModel(
name="Organisation",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField()),
],
),
migrations.CreateModel(
name="Person",
fields=[
Expand Down Expand Up @@ -81,23 +67,22 @@ class Migration(migrations.Migration):
name="Registrant",
fields=[
(
"organisation_ptr",
models.OneToOneField(
"id",
models.BigAutoField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="request.organisation",
verbose_name="ID",
),
),
("name", models.CharField()),
(
"type",
models.CharField(
choices=[
(
"Central government department or agency",
"Central Goverment",
"Central Government",
),
(
"Non-departmental body - also known as an arm's length body",
Expand All @@ -120,25 +105,28 @@ class Migration(migrations.Migration):
),
),
],
bases=("request.organisation",),
options={
"abstract": False,
},
),
migrations.CreateModel(
name="Registrar",
fields=[
(
"organisation_ptr",
models.OneToOneField(
"id",
models.BigAutoField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="request.organisation",
verbose_name="ID",
),
),
("name", models.CharField()),
("email_address", models.EmailField(max_length=320)),
],
bases=("request.organisation",),
options={
"abstract": False,
},
),
migrations.CreateModel(
name="Review",
Expand Down Expand Up @@ -188,6 +176,9 @@ class Migration(migrations.Migration):
),
),
],
options={
"default_related_name": "review",
},
),
migrations.CreateModel(
name="HistoricalReview",
Expand Down Expand Up @@ -309,34 +300,34 @@ class Migration(migrations.Migration):
),
migrations.AddField(
model_name="application",
name="registrant_person",
name="registrant_org",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="registrant_application",
to="request.person",
on_delete=django.db.models.deletion.CASCADE, to="request.registrant"
),
),
migrations.AddField(
model_name="application",
name="responsible_person",
name="registrant_person",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="responsible_application",
related_name="registrant_application",
to="request.person",
),
),
migrations.AddField(
model_name="application",
name="registrant_org",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to="request.registrant"
name="registrar",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="request.registrar"
),
),
migrations.AddField(
model_name="application",
name="registrar",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="request.registrar"
name="responsible_person",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="responsible_application",
to="request.person",
),
),
]

This file was deleted.

3 changes: 3 additions & 0 deletions request_a_govuk_domain/request/models/organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class Organisation(models.Model):
def __str__(self):
return self.name

class Meta:
abstract = True


class RegistrantTypeChoices(models.TextChoices):
central_government = "Central government department or agency"
Expand Down
44 changes: 10 additions & 34 deletions seed/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,59 +60,35 @@
}
},
{
"model": "request.organisation",
"model": "request.registrant",
"pk": 1,
"fields": {
"name": "The Registrar Co."
}
},
{
"model": "request.organisation",
"pk": 2,
"fields": {
"name": "The Ministry of Domains"
}
},
{
"model": "request.organisation",
"pk": 3,
"fields": {
"name": "The Registrar Co."
}
},
{
"model": "request.organisation",
"pk": 4,
"fields": {
"name": "The Ministry of Domains"
"type": "",
"name": "Ministry of Justice"
}
},
{
"model": "request.registrant",
"pk": 2,
"fields": {
"type": ""
}
},
{
"model": "request.registrant",
"pk": 4,
"fields": {
"type": ""
"type": "",
"name": "Department of Agriculture"
}
},
{
"model": "request.registrar",
"pk": 1,
"fields": {
"email_address": ""
"email_address": "",
"name": "WeRegister"
}
},
{
"model": "request.registrar",
"pk": 3,
"pk": 2,
"fields": {
"email_address": ""
"email_address": "",
"name": "Best Registrar Ltd"
}
},
{
Expand Down
6 changes: 0 additions & 6 deletions seed/reviewer_group.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
"fields": {
"name": "reviewer",
"permissions": [
28,
56,
45,
46,
38,
40
]
}
}
Expand Down

0 comments on commit 5597558

Please sign in to comment.