mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-06 04:27:22 +02:00
updated logic for deletion of CISA contact (deleting association only...)
This commit is contained in:
parent
7dc9dba833
commit
6ecd9e59fc
1 changed files with 7 additions and 2 deletions
|
@ -654,8 +654,13 @@ class CisaRepresentativeForm(BaseDeletableRegistrarForm):
|
|||
return
|
||||
contact = getattr(obj, "cisa_representative", None)
|
||||
if contact is not None and not contact.has_more_than_one_join("cisa_representative_domain_requests"):
|
||||
# if contact exists in the database and is not joined to other entities
|
||||
super().to_database(contact)
|
||||
if self.form_data_marked_for_deletion:
|
||||
# remove the CISA contact from this domain request
|
||||
obj.cisa_representative = None
|
||||
#QUESTION - should we also delete the contact object if it is not joined to other entities?
|
||||
else:
|
||||
# update existing contact if it is not joined to other enttities
|
||||
super().to_database(contact)
|
||||
else:
|
||||
# no contact exists OR contact exists which is joined also to other entities;
|
||||
# in either case, create a new contact and update it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue