mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-03 09:43:33 +02:00
update for code clarity
This commit is contained in:
parent
bf5867ffc9
commit
3a221ce1cc
1 changed files with 2 additions and 2 deletions
|
@ -96,7 +96,7 @@ class RegistrarFormSet(forms.BaseFormSet):
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def test_if_more_than_one_join(self, db_obj, rel, related_name):
|
def has_more_than_one_join(self, db_obj, rel, related_name):
|
||||||
"""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
|
||||||
# when determining if related objects exist. threshold is 0 for most
|
# when determining if related objects exist. threshold is 0 for most
|
||||||
|
@ -165,7 +165,7 @@ class RegistrarFormSet(forms.BaseFormSet):
|
||||||
# matching database object exists, update it
|
# matching database object exists, update it
|
||||||
if db_obj is not None and cleaned:
|
if db_obj is not None and cleaned:
|
||||||
if should_delete(cleaned):
|
if should_delete(cleaned):
|
||||||
if any(self.test_if_more_than_one_join(db_obj, rel, related_name) for rel in reverse_joins):
|
if any(self.has_more_than_one_join(db_obj, rel, related_name) for rel in reverse_joins):
|
||||||
# Remove the specific relationship without deleting the object
|
# Remove the specific relationship without deleting the object
|
||||||
getattr(db_obj, related_name).remove(self.application)
|
getattr(db_obj, related_name).remove(self.application)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue