mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-01 18:18:34 +02:00
PR feedback and new migration file based on PR #551
This commit is contained in:
parent
54e6121f46
commit
08b2060f35
4 changed files with 50 additions and 31 deletions
|
@ -207,12 +207,6 @@ class Migration(migrations.Migration):
|
|||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"alternative_domains",
|
||||
models.ManyToManyField(
|
||||
blank=True, related_name="alternatives+", to="registrar.website"
|
||||
),
|
||||
),
|
||||
(
|
||||
"authorizing_official",
|
||||
models.ForeignKey(
|
||||
|
@ -253,16 +247,6 @@ class Migration(migrations.Migration):
|
|||
to="registrar.domainapplication",
|
||||
),
|
||||
),
|
||||
(
|
||||
"investigator",
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name="information_investigating",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
(
|
||||
"other_contacts",
|
||||
models.ManyToManyField(
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
# Generated by Django 4.1.6 on 2023-05-09 19:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("registrar", "0018_domaininformation"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="domainapplication",
|
||||
name="organization_type",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
(
|
||||
"federal",
|
||||
"Federal: an agency of the U.S. government's executive, legislative, or judicial branches",
|
||||
),
|
||||
("interstate", "Interstate: an organization of two or more states"),
|
||||
(
|
||||
"state_or_territory",
|
||||
"State or territory: one of the 50 U.S. states, the District of Columbia, American Samoa, Guam, Northern Mariana Islands, Puerto Rico, or the U.S. Virgin Islands",
|
||||
),
|
||||
(
|
||||
"tribal",
|
||||
"Tribal: a tribal government recognized by the federal or a state government",
|
||||
),
|
||||
("county", "County: a county, parish, or borough"),
|
||||
("city", "City: a city, town, township, village, etc."),
|
||||
(
|
||||
"special_district",
|
||||
"Special district: an independent organization within a single state",
|
||||
),
|
||||
(
|
||||
"school_district",
|
||||
"School district: a school district that is not part of a local government",
|
||||
),
|
||||
],
|
||||
help_text="Type of organization",
|
||||
max_length=255,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -582,7 +582,7 @@ class DomainApplication(TimeStampedModel):
|
|||
"""This is to process to_dict for Domain Information, making it friendly
|
||||
to "copy" it
|
||||
|
||||
More information can be found at this- (This dev used #5)
|
||||
More information can be found at this- (This used #5)
|
||||
https://stackoverflow.com/questions/21925671/convert-django-model-object-to-dict-with-all-of-the-fields-intact/29088221#29088221"""
|
||||
opts = instance._meta
|
||||
data = {}
|
||||
|
|
|
@ -30,13 +30,6 @@ class DomainInformation(TimeStampedModel):
|
|||
on_delete=models.PROTECT,
|
||||
related_name="information_created",
|
||||
)
|
||||
investigator = models.ForeignKey(
|
||||
"registrar.User",
|
||||
null=True,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="information_investigating",
|
||||
)
|
||||
|
||||
domain_application = models.OneToOneField(
|
||||
"registrar.DomainApplication",
|
||||
|
@ -163,11 +156,6 @@ class DomainInformation(TimeStampedModel):
|
|||
related_name="domain_info",
|
||||
help_text="Domain to which this information belongs",
|
||||
)
|
||||
alternative_domains = models.ManyToManyField(
|
||||
"registrar.Website",
|
||||
blank=True,
|
||||
related_name="alternatives+",
|
||||
)
|
||||
|
||||
# This is the contact information provided by the applicant. The
|
||||
# application user who created it is in the `creator` field.
|
||||
|
@ -238,10 +226,11 @@ class DomainInformation(TimeStampedModel):
|
|||
# the following information below is not needed in the domain information:
|
||||
da_dict.pop("status")
|
||||
da_dict.pop("current_websites")
|
||||
da_dict.pop("investigator")
|
||||
da_dict.pop("alternative_domains")
|
||||
# use the requested_domain to create information for this domain
|
||||
da_dict["domain"] = da_dict.pop("requested_domain")
|
||||
other_contacts = da_dict.pop("other_contacts")
|
||||
alternative_domains = da_dict.pop("alternative_domains") # just in case
|
||||
domain_info = cls(**da_dict)
|
||||
domain_info.domain_application = domain_application
|
||||
# Save so the object now have PK
|
||||
|
@ -250,7 +239,6 @@ class DomainInformation(TimeStampedModel):
|
|||
|
||||
# Process the remaining "many to many" stuff
|
||||
domain_info.other_contacts.add(*other_contacts)
|
||||
domain_info.alternative_domains.add(*alternative_domains)
|
||||
domain_info.save()
|
||||
return domain_info
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue