formatted for linter

This commit is contained in:
David Kennedy 2024-01-12 18:07:02 -05:00
parent 73b0b33ee8
commit 946baf05e9
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
3 changed files with 6 additions and 4 deletions

View file

@ -33,7 +33,7 @@ class RegistrarForm(forms.Form):
# save a reference to an application object # save a reference to an application object
self.application = kwargs.pop("application", None) self.application = kwargs.pop("application", None)
super(RegistrarForm, self).__init__(*args, **kwargs) super(RegistrarForm, self).__init__(*args, **kwargs)
def to_database(self, obj: DomainApplication | Contact): def to_database(self, obj: DomainApplication | Contact):
""" """
Adds this form's cleaned data to `obj` and saves `obj`. Adds this form's cleaned data to `obj` and saves `obj`.
@ -329,7 +329,7 @@ class AboutYourOrganizationForm(RegistrarForm):
class AuthorizingOfficialForm(RegistrarForm): class AuthorizingOfficialForm(RegistrarForm):
JOIN = "authorizing_official" JOIN = "authorizing_official"
def to_database(self, obj): def to_database(self, obj):
if not self.is_valid(): if not self.is_valid():
return return

View file

@ -26,6 +26,7 @@ import re
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class DomainAddUserForm(forms.Form): class DomainAddUserForm(forms.Form):
"""Form for adding a user to a domain.""" """Form for adding a user to a domain."""
@ -212,6 +213,7 @@ class ContactForm(forms.ModelForm):
class AuthorizingOfficialContactForm(ContactForm): class AuthorizingOfficialContactForm(ContactForm):
"""Form for updating authorizing official contacts.""" """Form for updating authorizing official contacts."""
JOIN = "authorizing_official" JOIN = "authorizing_official"
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View file

@ -68,7 +68,7 @@ class Contact(TimeStampedModel):
"contact_applications_information", "contact_applications_information",
] ]
return any(self._has_more_than_one_join_per_relation(rel, expected_relation) for rel in all_relations) return any(self._has_more_than_one_join_per_relation(rel, expected_relation) for rel in all_relations)
def _has_more_than_one_join_per_relation(self, relation, expected_relation): def _has_more_than_one_join_per_relation(self, relation, expected_relation):
"""Helper for finding whether an object is joined more than once.""" """Helper for finding whether an object is joined more than once."""
# threshold is the number of related objects that are acceptable # threshold is the number of related objects that are acceptable
@ -96,7 +96,7 @@ class Contact(TimeStampedModel):
# the threshold # the threshold
return getattr(self, relation).count() > threshold return getattr(self, relation).count() > threshold
return False return False
def get_formatted_name(self): def get_formatted_name(self):
"""Returns the contact's name in Western order.""" """Returns the contact's name in Western order."""
names = [n for n in [self.first_name, self.middle_name, self.last_name] if n] names = [n for n in [self.first_name, self.middle_name, self.last_name] if n]