mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-18 10:29:23 +02:00
Remove submitter from models
This commit is contained in:
parent
f1c8f52456
commit
2f2b2fe10f
9 changed files with 59 additions and 60 deletions
|
@ -375,7 +375,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
|||
),
|
||||
"dotgov_domain": self.domain_request.requested_domain is not None,
|
||||
"purpose": self.domain_request.purpose is not None,
|
||||
"your_contact": self.domain_request.submitter is not None,
|
||||
"your_contact": self.domain_request.creator is not None,
|
||||
"other_contacts": (
|
||||
self.domain_request.other_contacts.exists()
|
||||
or self.domain_request.no_other_contacts_rationale is not None
|
||||
|
@ -813,7 +813,7 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView):
|
|||
|
||||
# After a delete occurs, do a second sweep on any returned duplicates.
|
||||
# This determines if any of these three fields share a contact, which is used for
|
||||
# the edge case where the same user may be an SO, and a submitter, for example.
|
||||
# the edge case where the same user may be an SO, and a creator, for example.
|
||||
if len(duplicates) > 0:
|
||||
duplicates_to_delete, _ = self._get_orphaned_contacts(domain_request, check_db=True)
|
||||
Contact.objects.filter(id__in=duplicates_to_delete).delete()
|
||||
|
@ -826,7 +826,7 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView):
|
|||
Collects all orphaned contacts associated with a given DomainRequest object.
|
||||
|
||||
An orphaned contact is defined as a contact that is associated with the domain request,
|
||||
but not with any other domain_request. This includes the senior official, the submitter,
|
||||
but not with any other domain_request. This includes the senior official, the creator,
|
||||
and any other contacts linked to the domain_request.
|
||||
|
||||
Parameters:
|
||||
|
@ -842,18 +842,18 @@ class DomainRequestDeleteView(DomainRequestPermissionDeleteView):
|
|||
|
||||
# Get each contact object on the DomainRequest object
|
||||
so = domain_request.senior_official
|
||||
submitter = domain_request.submitter
|
||||
creator = domain_request.creator
|
||||
other_contacts = list(domain_request.other_contacts.all())
|
||||
other_contact_ids = domain_request.other_contacts.all().values_list("id", flat=True)
|
||||
|
||||
# Check if the desired item still exists in the DB
|
||||
if check_db:
|
||||
so = self._get_contacts_by_id([so.id]).first() if so is not None else None
|
||||
submitter = self._get_contacts_by_id([submitter.id]).first() if submitter is not None else None
|
||||
creator = self._get_contacts_by_id([creator.id]).first() if creator is not None else None
|
||||
other_contacts = self._get_contacts_by_id(other_contact_ids)
|
||||
|
||||
# Pair each contact with its db related name for use in checking if it has joins
|
||||
checked_contacts = [(so, "senior_official"), (submitter, "submitted_domain_requests")]
|
||||
checked_contacts = [(so, "senior_official"), (creator, "submitted_domain_requests")]
|
||||
checked_contacts.extend((contact, "contact_domain_requests") for contact in other_contacts)
|
||||
|
||||
for contact, related_name in checked_contacts:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue