PR edit: remove lables, replace with verbose_name, comment required attributes

This commit is contained in:
igorkorenfeld 2023-06-09 11:46:33 -04:00
parent dd7bc34cbf
commit 8d8c2a258c
No known key found for this signature in database
GPG key ID: 826947A4B867F659
2 changed files with 8 additions and 6 deletions

View file

@ -93,12 +93,6 @@ class DomainOrgNameAddressForm(forms.ModelForm):
"zipcode", "zipcode",
"urbanization", "urbanization",
] ]
labels = {
"address_line1": "Street address",
"address_line2": "Street address line 2",
"state_territory": "State, territory, or military post",
"urbanization": "Urbanization (Puerto Rico only)",
}
error_messages = { error_messages = {
"federal_agency": { "federal_agency": {
"required": "Select the federal agency for your organization." "required": "Select the federal agency for your organization."
@ -114,6 +108,10 @@ class DomainOrgNameAddressForm(forms.ModelForm):
}, },
} }
widgets = { widgets = {
# We need to set the required attributed for federal_agency and
# state/territory because for these fields we are creating an individual
# instance of the Select. For the other fields we use the for loop to set
# the class's required attribute to true.
"federal_agency": forms.Select( "federal_agency": forms.Select(
attrs={"required": True}, choices=DomainInformation.AGENCY_CHOICES attrs={"required": True}, choices=DomainInformation.AGENCY_CHOICES
), ),

View file

@ -100,11 +100,13 @@ class DomainInformation(TimeStampedModel):
null=True, null=True,
blank=True, blank=True,
help_text="Street address", help_text="Street address",
verbose_name="Street address",
) )
address_line2 = models.TextField( address_line2 = models.TextField(
null=True, null=True,
blank=True, blank=True,
help_text="Street address line 2", help_text="Street address line 2",
verbose_name="Street address line 2",
) )
city = models.TextField( city = models.TextField(
null=True, null=True,
@ -116,6 +118,7 @@ class DomainInformation(TimeStampedModel):
null=True, null=True,
blank=True, blank=True,
help_text="State, territory, or military post", help_text="State, territory, or military post",
verbose_name="State, territory, or military post",
) )
zipcode = models.CharField( zipcode = models.CharField(
max_length=10, max_length=10,
@ -128,6 +131,7 @@ class DomainInformation(TimeStampedModel):
null=True, null=True,
blank=True, blank=True,
help_text="Urbanization (Puerto Rico only)", help_text="Urbanization (Puerto Rico only)",
verbose_name="Urbanization (Puerto Rico only)",
) )
type_of_work = models.TextField( type_of_work = models.TextField(