mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
small refactors and linting
This commit is contained in:
parent
7851672dbc
commit
70dfccbb2e
2 changed files with 3 additions and 6 deletions
|
@ -250,11 +250,8 @@ class AuthorizingOfficialContactForm(ContactForm):
|
||||||
# has more than one joined object.
|
# has more than one joined object.
|
||||||
# In this case, create a new Contact, and update the new Contact with form data.
|
# In this case, create a new Contact, and update the new Contact with form data.
|
||||||
# Then associate with domain information object as the authorizing_official
|
# Then associate with domain information object as the authorizing_official
|
||||||
contact = Contact()
|
data = dict(self.cleaned_data.items())
|
||||||
for name, value in self.cleaned_data.items():
|
self.domainInfo.authorizing_official = Contact.objects.create(**data)
|
||||||
setattr(contact, name, value)
|
|
||||||
contact.save()
|
|
||||||
self.domainInfo.authorizing_official = contact
|
|
||||||
self.domainInfo.save()
|
self.domainInfo.save()
|
||||||
else:
|
else:
|
||||||
super().save()
|
super().save()
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Contact(TimeStampedModel):
|
||||||
|
|
||||||
def _get_all_relations(self):
|
def _get_all_relations(self):
|
||||||
return [f.name for f in self._meta.get_fields() if f.is_relation]
|
return [f.name for f in self._meta.get_fields() if f.is_relation]
|
||||||
|
|
||||||
def has_more_than_one_join(self, expected_relation):
|
def has_more_than_one_join(self, expected_relation):
|
||||||
"""Helper for finding whether an object is joined more than once.
|
"""Helper for finding whether an object is joined more than once.
|
||||||
expected_relation is the one relation with one expected join"""
|
expected_relation is the one relation with one expected join"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue