mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-16 22:44:11 +02:00
fix eop contact deletable functionality
This commit is contained in:
parent
398958e1bf
commit
71c3332c72
1 changed files with 13 additions and 8 deletions
|
@ -177,16 +177,21 @@ class EOPContactForm(BaseDeletableRegistrarForm):
|
|||
|
||||
@classmethod
|
||||
def from_database(cls, obj):
|
||||
# if not obj.eop_contact:
|
||||
# return {}
|
||||
# return {
|
||||
# "first_name": obj.feb_eop_contact.first_name,
|
||||
# "last_name": obj.feb_eop_contact.last_name,
|
||||
# "email": obj.feb_eop_contact.email,
|
||||
# }
|
||||
return {}
|
||||
if not obj.eop_contact:
|
||||
return {}
|
||||
return {
|
||||
"first_name": obj.feb_eop_contact.first_name,
|
||||
"last_name": obj.feb_eop_contact.last_name,
|
||||
"email": obj.feb_eop_contact.email,
|
||||
}
|
||||
|
||||
def to_database(self, obj):
|
||||
# This function overrides the behavior of the BaseDeletableRegistrarForm.
|
||||
# in order to preserve deletable functionality, we need to call the
|
||||
# superclass's to_database method if the form is marked for deletion.
|
||||
if self.form_data_marked_for_deletion:
|
||||
super().to_database(obj)
|
||||
return
|
||||
if not self.is_valid():
|
||||
return
|
||||
obj.eop_contact = Contact.objects.create(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue