mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-17 15:04: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
|
@classmethod
|
||||||
def from_database(cls, obj):
|
def from_database(cls, obj):
|
||||||
# if not obj.eop_contact:
|
if not obj.eop_contact:
|
||||||
# return {}
|
return {}
|
||||||
# return {
|
return {
|
||||||
# "first_name": obj.feb_eop_contact.first_name,
|
"first_name": obj.feb_eop_contact.first_name,
|
||||||
# "last_name": obj.feb_eop_contact.last_name,
|
"last_name": obj.feb_eop_contact.last_name,
|
||||||
# "email": obj.feb_eop_contact.email,
|
"email": obj.feb_eop_contact.email,
|
||||||
# }
|
}
|
||||||
return {}
|
|
||||||
|
|
||||||
def to_database(self, obj):
|
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():
|
if not self.is_valid():
|
||||||
return
|
return
|
||||||
obj.eop_contact = Contact.objects.create(
|
obj.eop_contact = Contact.objects.create(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue