Fix form field w/ refactor

This commit is contained in:
zandercymatics 2024-04-15 11:33:21 -06:00
parent 9d872d065c
commit 3c1c888356
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
7 changed files with 17 additions and 6 deletions

View file

@ -72,6 +72,7 @@ def check_domain_available(domain):
given domain doesn't end with .gov, ".gov" is added when looking for
a match. If check fails, throws a RegistryError.
"""
return True
Domain = apps.get_model("registrar.Domain")
if domain.endswith(".gov"):

View file

@ -851,8 +851,16 @@ class NoOtherContactsForm(BaseDeletableRegistrarForm):
class CisaRepresentativeForm(BaseDeletableRegistrarForm):
cisa_representative_email = forms.EmailField(
required=False,
label="Are you working with a CISA representative?", # TODO-NL: (design check) - is this the right label?
required=True,
max_length=None,
error_messages={"invalid": ("Enter your email address in the required format, like name@example.com.")},
label="Your representatives email",
validators=[
MaxLengthValidator(
320,
message="Response must be less than 320 characters.",
)
],
)

View file

@ -1,4 +1,4 @@
# Generated by Django 4.2.10 on 2024-04-11 21:40
# Generated by Django 4.2.10 on 2024-04-15 17:30
from django.db import migrations, models
@ -14,14 +14,14 @@ class Migration(migrations.Migration):
model_name="domaininformation",
name="cisa_representative_email",
field=models.EmailField(
blank=True, db_index=True, max_length=254, null=True, verbose_name="CISA region representative"
blank=True, db_index=True, max_length=320, null=True, verbose_name="CISA region representative"
),
),
migrations.AddField(
model_name="domainrequest",
name="cisa_representative_email",
field=models.EmailField(
blank=True, db_index=True, max_length=254, null=True, verbose_name="CISA region representative"
blank=True, db_index=True, max_length=320, null=True, verbose_name="CISA region representative"
),
),
migrations.AlterField(

View file

@ -221,6 +221,7 @@ class DomainInformation(TimeStampedModel):
blank=True,
db_index=True,
verbose_name="CISA region representative",
max_length=320,
)
is_policy_acknowledged = models.BooleanField(

View file

@ -652,6 +652,7 @@ class DomainRequest(TimeStampedModel):
blank=True,
db_index=True,
verbose_name="CISA region representative",
max_length=320,
)
is_policy_acknowledged = models.BooleanField(

View file

@ -26,7 +26,6 @@
</fieldset>
<div id="cisa-representative" class="cisa-representative-form">
<p>Your representatives email (*)</p>
{% input_with_errors forms.1.cisa_representative_email %}
{# forms.1 is a form for inputting the e-mail of a cisa representative #}
<!-- TODO-NL: Hookup forms.1 to cisa representative form (backend def) -->

View file

@ -1678,6 +1678,7 @@ class TestDomainRequestAdmin(MockEppLib):
"purpose",
"no_other_contacts_rationale",
"anything_else",
"cisa_representative_email",
"is_policy_acknowledged",
"submission_date",
"notes",