Add notes field

This commit is contained in:
zandercymatics 2024-01-24 13:46:53 -07:00
parent 9b691affdc
commit 65ff4ece76
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
5 changed files with 76 additions and 8 deletions

View file

@ -737,7 +737,18 @@ class DomainApplicationAdmin(ListHeaderAdmin):
# Detail view
form = DomainApplicationAdminForm
fieldsets = [
(None, {"fields": ["status", "investigator", "creator", "approved_domain"]}),
(
None,
{
"fields": [
"status",
"investigator",
"creator",
"approved_domain",
"notes"
]
}
),
(
"Type of organization",
{
@ -991,6 +1002,22 @@ class DomainAdmin(ListHeaderAdmin):
"deleted",
]
fieldsets = (
(
None,
{
"fields": [
"name",
"state",
"expiration_date",
"first_ready",
"deleted",
"notes"
]
},
),
)
# this ordering effects the ordering of results
# in autocomplete_fields for domain
ordering = ["name"]

View file

@ -0,0 +1,22 @@
# Generated by Django 4.2.7 on 2024-01-24 20:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("registrar", "0063_veryimportantperson"),
]
operations = [
migrations.AddField(
model_name="domain",
name="notes",
field=models.TextField(blank=True, help_text="Notes about this domain", null=True),
),
migrations.AddField(
model_name="domainapplication",
name="notes",
field=models.TextField(blank=True, help_text="Notes about this application", null=True),
),
]

View file

@ -992,6 +992,12 @@ class Domain(TimeStampedModel, DomainHelper):
help_text="The last time this domain moved into the READY state",
)
notes = models.TextField(
null=True,
blank=True,
help_text="Notes about this domain",
)
def isActive(self):
return self.state == Domain.State.CREATED

View file

@ -556,6 +556,12 @@ class DomainApplication(TimeStampedModel):
help_text="Date submitted",
)
notes = models.TextField(
null=True,
blank=True,
help_text="Notes about this application",
)
def __str__(self):
try:
if self.requested_domain and self.requested_domain.name:

View file

@ -223,13 +223,20 @@ class DomainInformation(TimeStampedModel):
if domain_info:
return domain_info
# the following information below is not needed in the domain information:
da_dict.pop("status", None)
da_dict.pop("current_websites", None)
da_dict.pop("investigator", None)
da_dict.pop("alternative_domains", None)
da_dict.pop("requested_domain", None)
da_dict.pop("approved_domain", None)
da_dict.pop("submission_date", None)
unused_one_to_one_fields = [
"status",
"current_websites",
"investigator",
"alternative_domains",
"requested_domain",
"approved_domain",
"submission_date",
"other_contacts",
"notes",
]
for field in unused_one_to_one_fields:
da_dict.pop(field, None)
other_contacts = da_dict.pop("other_contacts", [])
domain_info = cls(**da_dict)
domain_info.domain_application = domain_application