mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-10 22:44:47 +02:00
accidently removed something, putting back in
This commit is contained in:
parent
4498ae7847
commit
39598bbc21
2 changed files with 8 additions and 4 deletions
|
@ -516,6 +516,10 @@ class DomainApplication(TimeStampedModel):
|
|||
application into an admin on that domain.
|
||||
"""
|
||||
|
||||
# create the domain if it doesn't exist
|
||||
Domain = apps.get_model("registrar.Domain")
|
||||
created_domain, _ = Domain.objects.get_or_create(name=self.requested_domain)
|
||||
|
||||
# create the permission for the user
|
||||
UserDomainRole = apps.get_model("registrar.UserDomainRole")
|
||||
UserDomainRole.objects.get_or_create(
|
||||
|
|
|
@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
class DomainInformation(TimeStampedModel):
|
||||
|
||||
"""A registrant's domain information for that domain, exported from
|
||||
"""A registrant's domain information for that domain, exported from
|
||||
DomainApplication."""
|
||||
|
||||
StateTerritoryChoices = DomainApplication.StateTerritoryChoices
|
||||
|
@ -160,7 +160,7 @@ class DomainInformation(TimeStampedModel):
|
|||
blank=True,
|
||||
null=True,
|
||||
# Access this information via Domain as "domain.info"
|
||||
related_name="domain_info",
|
||||
related_name="domain_info",
|
||||
help_text="Domain to which this information belongs",
|
||||
)
|
||||
alternative_domains = models.ManyToManyField(
|
||||
|
@ -230,7 +230,7 @@ class DomainInformation(TimeStampedModel):
|
|||
da_dict = domain_application.to_dict()
|
||||
# remove the id so one can be assinged on creation
|
||||
da_id = da_dict.pop("id")
|
||||
# check if we have a record that corresponds with the domain
|
||||
# check if we have a record that corresponds with the domain
|
||||
# application, if so short circuit the create
|
||||
domain_info = cls.objects.filter(domain_application__id=da_id).first()
|
||||
if domain_info:
|
||||
|
@ -244,7 +244,7 @@ class DomainInformation(TimeStampedModel):
|
|||
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
|
||||
# Save so the object now have PK
|
||||
# (needed to process the manytomany below before, first)
|
||||
domain_info.save()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue