mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-29 14:06:32 +02:00
break eop stakeholder into multiple fields
This commit is contained in:
parent
44da71b007
commit
b2fd131c30
5 changed files with 56 additions and 47 deletions
|
@ -147,8 +147,6 @@ class EOPContactForm(BaseDeletableRegistrarForm):
|
||||||
Executive Branch (FEB) agency is working with.
|
Executive Branch (FEB) agency is working with.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
field_name = "eop_contact"
|
|
||||||
|
|
||||||
first_name = forms.CharField(
|
first_name = forms.CharField(
|
||||||
label="First name / given name",
|
label="First name / given name",
|
||||||
error_messages={"required": "Enter the first name / given name of this contact."},
|
error_messages={"required": "Enter the first name / given name of this contact."},
|
||||||
|
@ -178,12 +176,10 @@ class EOPContactForm(BaseDeletableRegistrarForm):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_database(cls, obj):
|
def from_database(cls, obj):
|
||||||
if not obj.eop_contact:
|
|
||||||
return {}
|
|
||||||
return {
|
return {
|
||||||
"first_name": obj.eop_contact.first_name,
|
"first_name": obj.eop_stakeholder_first_name,
|
||||||
"last_name": obj.eop_contact.last_name,
|
"last_name": obj.eop_stakeholder_last_name,
|
||||||
"email": obj.eop_contact.email,
|
"email": obj.eop_stakeholder_email,
|
||||||
}
|
}
|
||||||
|
|
||||||
def to_database(self, obj):
|
def to_database(self, obj):
|
||||||
|
@ -195,11 +191,9 @@ class EOPContactForm(BaseDeletableRegistrarForm):
|
||||||
return
|
return
|
||||||
if not self.is_valid():
|
if not self.is_valid():
|
||||||
return
|
return
|
||||||
obj.eop_contact = Contact.objects.create(
|
obj.eop_stakeholder_first_name = self.cleaned_data["first_name"]
|
||||||
first_name=self.cleaned_data["first_name"],
|
obj.eop_stakeholder_last_name = self.cleaned_data["last_name"]
|
||||||
last_name=self.cleaned_data["last_name"],
|
obj.eop_stakeholder_email = self.cleaned_data["email"]
|
||||||
email=self.cleaned_data["email"],
|
|
||||||
)
|
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Generated by Django 4.2.17 on 2025-03-11 18:10
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("registrar", "0142_domainrequest_feb_naming_requirements_and_more"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="domainrequest",
|
|
||||||
name="eop_contact",
|
|
||||||
field=models.ForeignKey(
|
|
||||||
blank=True,
|
|
||||||
null=True,
|
|
||||||
on_delete=django.db.models.deletion.PROTECT,
|
|
||||||
related_name="eop_contact",
|
|
||||||
to="registrar.contact",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="domainrequest",
|
|
||||||
name="working_with_eop",
|
|
||||||
field=models.BooleanField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Generated by Django 4.2.17 on 2025-03-17 20:44
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("registrar", "0142_domainrequest_feb_naming_requirements_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="domainrequest",
|
||||||
|
name="eop_stakeholder_email",
|
||||||
|
field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="EOP Stakeholder Email"),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="domainrequest",
|
||||||
|
name="eop_stakeholder_first_name",
|
||||||
|
field=models.CharField(blank=True, null=True, verbose_name="EOP Stakeholder First Name"),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="domainrequest",
|
||||||
|
name="eop_stakeholder_last_name",
|
||||||
|
field=models.CharField(blank=True, null=True, verbose_name="EOP Stakeholder Last Name"),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="domainrequest",
|
||||||
|
name="working_with_eop",
|
||||||
|
field=models.BooleanField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -528,12 +528,22 @@ class DomainRequest(TimeStampedModel):
|
||||||
blank=True,
|
blank=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
eop_contact = models.ForeignKey(
|
eop_stakeholder_first_name = models.CharField(
|
||||||
"registrar.Contact",
|
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
related_name="eop_contact",
|
verbose_name="EOP Stakeholder First Name",
|
||||||
on_delete=models.PROTECT,
|
)
|
||||||
|
|
||||||
|
eop_stakeholder_last_name = models.CharField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
verbose_name="EOP Stakeholder Last Name",
|
||||||
|
)
|
||||||
|
|
||||||
|
eop_stakeholder_email = models.EmailField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
verbose_name="EOP Stakeholder Email",
|
||||||
)
|
)
|
||||||
|
|
||||||
# This field is alternately used for generic domain purpose explanations
|
# This field is alternately used for generic domain purpose explanations
|
||||||
|
|
|
@ -1985,7 +1985,9 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
"feb_naming_requirements_details",
|
"feb_naming_requirements_details",
|
||||||
"feb_purpose_choice",
|
"feb_purpose_choice",
|
||||||
"working_with_eop",
|
"working_with_eop",
|
||||||
"eop_contact",
|
"eop_stakeholder_first_name",
|
||||||
|
"eop_stakeholder_last_name",
|
||||||
|
"eop_stakeholder_email",
|
||||||
"purpose",
|
"purpose",
|
||||||
"has_timeframe",
|
"has_timeframe",
|
||||||
"time_frame_details",
|
"time_frame_details",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue