mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
Bug fix
This commit is contained in:
parent
947b347513
commit
2a345cddb9
1 changed files with 3 additions and 5 deletions
|
@ -231,8 +231,8 @@ class DomainInformation(TimeStampedModel):
|
|||
return existing_domain_info
|
||||
|
||||
# Get a list of the existing fields on DomainApplication and DomainInformation
|
||||
domain_app_fields = set(field.name for field in DomainApplication._meta.get_fields())
|
||||
domain_info_fields = set(field.name for field in DomainInformation._meta.get_fields())
|
||||
domain_app_fields = set(field.name for field in DomainApplication._meta.get_fields() if field != "id")
|
||||
domain_info_fields = set(field.name for field in DomainInformation._meta.get_fields() if field != "id")
|
||||
|
||||
# Get a list of all many_to_many relations on DomainInformation (needs to be saved differently)
|
||||
info_many_to_many_fields = {field.name for field in DomainInformation._meta.many_to_many}
|
||||
|
@ -251,6 +251,7 @@ class DomainInformation(TimeStampedModel):
|
|||
elif hasattr(domain_application, field):
|
||||
da_many_to_many_dict[field] = getattr(domain_application, field).all()
|
||||
|
||||
# Create a placeholder DomainInformation object
|
||||
domain_info = DomainInformation(**da_dict)
|
||||
|
||||
# Add the domain_application and domain fields
|
||||
|
@ -258,9 +259,6 @@ class DomainInformation(TimeStampedModel):
|
|||
if domain:
|
||||
domain_info.domain = domain
|
||||
|
||||
# Create the object
|
||||
domain_info.save()
|
||||
|
||||
# Save the instance and set the many-to-many fields.
|
||||
# Lumped under .atomic to ensure we don't make redundant DB calls.
|
||||
# This bundles them all together, and then saves it in a single call.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue