-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add application and associated models
Models to reflect the current thinking on the data required to make a decision on an application. In the Review model we use the simple-history package to track changes made to the review fields.
- Loading branch information
Showing
6 changed files
with
131 additions
and
10 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from .application import Application, ApplicationStatus, CentralGovernmentAttributes | ||
from .organisation import Organisation, Registrant, Registrar, RegistrantTypeChoices | ||
from .person import Person | ||
from .review import Review | ||
|
||
__all__ = [ | ||
"Application", | ||
"ApplicationStatus", | ||
"CentralGovernmentAttributes", | ||
"Organisation", | ||
"Registrant", | ||
"Registrar", | ||
"RegistrantTypeChoices", | ||
"Person", | ||
"Review", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from django.db import models | ||
from .person import Person | ||
from .organisation import Registrant, Registrar | ||
from .review import Review | ||
|
||
REF_NUM_LENGTH = 6 | ||
|
||
|
||
class ApplicationStatus(models.TextChoices): | ||
approved = "Approved" | ||
rejected = "Rejected" | ||
pending = "Pending" | ||
|
||
|
||
class Application(models.Model): | ||
_reference = models.CharField(max_length=REF_NUM_LENGTH, blank=True) | ||
status = models.CharField( | ||
choices=ApplicationStatus.choices, | ||
default=ApplicationStatus.pending, | ||
max_length=8, | ||
) | ||
domain_name = models.CharField(max_length=253) | ||
applicant = Person() | ||
registrant_person = Person() | ||
responsible_person = Person() | ||
registrant_org = Registrant() | ||
registrar = Registrar() | ||
written_permission_evidence = models.FileField | ||
review = Review() | ||
|
||
@property | ||
def reference(self): | ||
if not self._reference: | ||
self._reference = hex(self.id)[2:].upper().zfill(REF_NUM_LENGTH) | ||
return self._reference | ||
|
||
|
||
class CentralGovernmentAttributes(models.Model): | ||
application = models.OneToOneField(Application, on_delete=models.CASCADE) | ||
domain_purpose = models.CharField() | ||
ministerial_request_evidence = models.FileField | ||
gds_exemption_evidence = models.FileField | ||
|
||
class Meta: | ||
default_related_name = "centralgovt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django.db import models | ||
|
||
|
||
class Organisation(models.Model): | ||
name = models.CharField() | ||
|
||
|
||
class RegistrantTypeChoices(models.TextChoices): | ||
central_goverment = "Central government department or agency" | ||
ndpb = "Non-departmental body - also known as an arm's length body" | ||
fire_service = "Fire Service" | ||
local_authority = "County, borough, metropolitan or district council" | ||
parish_council = "Parish, town or community council" | ||
village_council = "Neighbourhood or village council" | ||
combined_authority = "Combined or unitary authority" | ||
pcc = "Police and Crime Commissioner" | ||
joint_authority = "Joint Authority" | ||
joint_committee = "Joint Committee" | ||
representative = "Representing public sector bodies" | ||
|
||
|
||
class Registrant(Organisation): | ||
type = models.CharField(choices=RegistrantTypeChoices.choices, max_length=100) | ||
|
||
|
||
class Registrar(Organisation): | ||
email_address = models.EmailField(max_length=320) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.db import models | ||
from phonenumber_field.modelfields import PhoneNumberField | ||
|
||
|
||
class Person(models.Model): | ||
name = models.CharField() # We don't need to set a max under Django 4.2 | ||
email_address = models.EmailField(max_length=320) | ||
role = models.CharField() | ||
phone_number = PhoneNumberField(blank=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from django.db import models | ||
from simple_history.models import HistoricalRecords | ||
|
||
NOTES_MAX_LENGTH = 500 | ||
|
||
|
||
class Review(models.Model): | ||
registrant_org_exists = models.BooleanField(default=False) | ||
registrant_org_exists_notes = models.TextField(max_length=NOTES_MAX_LENGTH) | ||
|
||
registrant_org_eligible = models.BooleanField(default=False) | ||
registrant_org_eligible_notes = models.TextField(max_length=NOTES_MAX_LENGTH) | ||
|
||
registrant_person_id_confirmed = models.BooleanField(default=False) | ||
registrant_person_id_confirmed_notes = models.TextField(max_length=NOTES_MAX_LENGTH) | ||
|
||
permission_signatory_role_confirmed = models.BooleanField(default=False) | ||
permission_signatory_role_confirmed_notes = models.TextField( | ||
max_length=NOTES_MAX_LENGTH | ||
) | ||
|
||
domain_name_validated = models.BooleanField(default=False) | ||
domain_name_validated_notes = models.TextField(max_length=NOTES_MAX_LENGTH) | ||
|
||
gds_exemption_validated = models.BooleanField(null=True) | ||
gds_exemption_validated_notes = models.TextField(max_length=NOTES_MAX_LENGTH) | ||
|
||
ministerial_request_validated = models.BooleanField(null=True) | ||
ministerial_request_validated_notes = models.TextField(max_length=NOTES_MAX_LENGTH) | ||
|
||
nac_appeal_validated = models.BooleanField(null=True) | ||
nac_appeal_validated_notes = models.TextField(max_length=NOTES_MAX_LENGTH) | ||
|
||
history = HistoricalRecords() |