Skip to content

Commit

Permalink
Merge pull request #1825 from cisagov/nl/1045-reduce-field-sizes-in-a…
Browse files Browse the repository at this point in the history
…dmin

Issue #1045: reduce field sizes in admin
  • Loading branch information
CocoByte authored Feb 28, 2024
2 parents dc34ee6 + 50478c5 commit b355f18
Show file tree
Hide file tree
Showing 6 changed files with 913 additions and 47 deletions.

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/registrar/models/contact.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.db import models

from phonenumber_field.modelfields import PhoneNumberField # type: ignore

from .utility.time_stamped_model import TimeStampedModel

from phonenumber_field.modelfields import PhoneNumberField # type: ignore


class Contact(TimeStampedModel):
"""Contact information follows a similar pattern for each contact."""
Expand All @@ -15,23 +15,23 @@ class Contact(TimeStampedModel):
on_delete=models.SET_NULL,
)

first_name = models.TextField(
first_name = models.CharField(
null=True,
blank=True,
verbose_name="first name / given name",
db_index=True,
)
middle_name = models.TextField(
middle_name = models.CharField(
null=True,
blank=True,
)
last_name = models.TextField(
last_name = models.CharField(
null=True,
blank=True,
verbose_name="last name / family name",
db_index=True,
)
title = models.TextField(
title = models.CharField(
null=True,
blank=True,
verbose_name="title or role in your organization",
Expand Down
14 changes: 7 additions & 7 deletions src/registrar/models/domain_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,13 @@ class RejectionReasons(models.TextChoices):
help_text="Is the tribe recognized by a state",
)

tribe_name = models.TextField(
tribe_name = models.CharField(
null=True,
blank=True,
help_text="Name of tribe",
)

federal_agency = models.TextField(
federal_agency = models.CharField(
choices=AGENCY_CHOICES,
null=True,
blank=True,
Expand All @@ -442,25 +442,25 @@ class RejectionReasons(models.TextChoices):
help_text="Is your organization an election office?",
)

organization_name = models.TextField(
organization_name = models.CharField(
null=True,
blank=True,
help_text="Organization name",
db_index=True,
)
address_line1 = models.TextField(
address_line1 = models.CharField(
null=True,
blank=True,
help_text="Street address",
verbose_name="Address line 1",
)
address_line2 = models.TextField(
address_line2 = models.CharField(
null=True,
blank=True,
help_text="Street address line 2 (optional)",
verbose_name="Address line 2",
)
city = models.TextField(
city = models.CharField(
null=True,
blank=True,
help_text="City",
Expand All @@ -479,7 +479,7 @@ class RejectionReasons(models.TextChoices):
help_text="Zip code",
db_index=True,
)
urbanization = models.TextField(
urbanization = models.CharField(
null=True,
blank=True,
help_text="Urbanization (required for Puerto Rico only)",
Expand Down
14 changes: 7 additions & 7 deletions src/registrar/models/domain_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class DomainInformation(TimeStampedModel):
help_text="Is the tribe recognized by a state",
)

tribe_name = models.TextField(
tribe_name = models.CharField(
null=True,
blank=True,
help_text="Name of tribe",
)

federal_agency = models.TextField(
federal_agency = models.CharField(
choices=AGENCY_CHOICES,
null=True,
blank=True,
Expand All @@ -94,25 +94,25 @@ class DomainInformation(TimeStampedModel):
help_text="Is your organization an election office?",
)

organization_name = models.TextField(
organization_name = models.CharField(
null=True,
blank=True,
help_text="Organization name",
db_index=True,
)
address_line1 = models.TextField(
address_line1 = models.CharField(
null=True,
blank=True,
help_text="Street address",
verbose_name="Street address",
)
address_line2 = models.TextField(
address_line2 = models.CharField(
null=True,
blank=True,
help_text="Street address line 2 (optional)",
verbose_name="Street address line 2 (optional)",
)
city = models.TextField(
city = models.CharField(
null=True,
blank=True,
help_text="City",
Expand All @@ -132,7 +132,7 @@ class DomainInformation(TimeStampedModel):
help_text="Zip code",
db_index=True,
)
urbanization = models.TextField(
urbanization = models.CharField(
null=True,
blank=True,
help_text="Urbanization (required for Puerto Rico only)",
Expand Down
28 changes: 15 additions & 13 deletions src/registrar/models/public_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from .utility.time_stamped_model import TimeStampedModel

from phonenumber_field.modelfields import PhoneNumberField # type: ignore


def get_id():
"""Generate a 16 character registry ID with a low probability of collision."""
Expand Down Expand Up @@ -59,22 +61,22 @@ def save(self, *args, **kwargs):
related_name="contacts",
)

name = models.TextField(null=False, help_text="Contact's full name")
org = models.TextField(null=True, help_text="Contact's organization (null ok)")
street1 = models.TextField(null=False, help_text="Contact's street")
street2 = models.TextField(null=True, help_text="Contact's street (null ok)")
street3 = models.TextField(null=True, help_text="Contact's street (null ok)")
city = models.TextField(null=False, help_text="Contact's city")
sp = models.TextField(null=False, help_text="Contact's state or province")
pc = models.TextField(null=False, help_text="Contact's postal code")
cc = models.TextField(null=False, help_text="Contact's country code")
email = models.TextField(null=False, help_text="Contact's email address")
voice = models.TextField(null=False, help_text="Contact's phone number. Must be in ITU.E164.2005 format")
fax = models.TextField(
name = models.CharField(null=False, help_text="Contact's full name")
org = models.CharField(null=True, help_text="Contact's organization (null ok)")
street1 = models.CharField(null=False, help_text="Contact's street")
street2 = models.CharField(null=True, help_text="Contact's street (null ok)")
street3 = models.CharField(null=True, help_text="Contact's street (null ok)")
city = models.CharField(null=False, help_text="Contact's city")
sp = models.CharField(null=False, help_text="Contact's state or province")
pc = models.CharField(null=False, help_text="Contact's postal code")
cc = models.CharField(null=False, help_text="Contact's country code")
email = models.EmailField(null=False, help_text="Contact's email address")
voice = PhoneNumberField(null=False, help_text="Contact's phone number. Must be in ITU.E164.2005 format")
fax = PhoneNumberField(
null=True,
help_text="Contact's fax number (null ok). Must be in ITU.E164.2005 format.",
)
pw = models.TextField(null=False, help_text="Contact's authorization code. 16 characters minimum.")
pw = models.CharField(null=False, help_text="Contact's authorization code. 16 characters minimum.")

@classmethod
def get_default_registrant(cls):
Expand Down
28 changes: 14 additions & 14 deletions src/registrar/models/transition_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class TransitionDomain(TimeStampedModel):
# classes that import TransitionDomain
StatusChoices = StatusChoices

username = models.TextField(
username = models.CharField(
null=False,
blank=False,
verbose_name="Username",
help_text="Username - this will be an email address",
)
domain_name = models.TextField(
domain_name = models.CharField(
null=True,
blank=True,
verbose_name="Domain name",
Expand All @@ -49,25 +49,25 @@ class TransitionDomain(TimeStampedModel):
verbose_name="Processed",
help_text="Indicates whether this TransitionDomain was already processed",
)
organization_type = models.TextField(
organization_type = models.CharField(
max_length=255,
null=True,
blank=True,
help_text="Type of organization",
)
organization_name = models.TextField(
organization_name = models.CharField(
null=True,
blank=True,
help_text="Organization name",
db_index=True,
)
federal_type = models.TextField(
federal_type = models.CharField(
max_length=50,
null=True,
blank=True,
help_text="Federal government branch",
)
federal_agency = models.TextField(
federal_agency = models.CharField(
null=True,
blank=True,
help_text="Federal agency",
Expand All @@ -80,44 +80,44 @@ class TransitionDomain(TimeStampedModel):
null=True,
help_text=("Duplication of registry's expiration " "date saved for ease of reporting"),
)
first_name = models.TextField(
first_name = models.CharField(
null=True,
blank=True,
help_text="First name",
verbose_name="first name / given name",
db_index=True,
)
middle_name = models.TextField(
middle_name = models.CharField(
null=True,
blank=True,
help_text="Middle name (optional)",
)
last_name = models.TextField(
last_name = models.CharField(
null=True,
blank=True,
help_text="Last name",
)
title = models.TextField(
title = models.CharField(
null=True,
blank=True,
help_text="Title",
)
email = models.TextField(
email = models.EmailField(
null=True,
blank=True,
help_text="Email",
)
phone = models.TextField(
phone = models.CharField(
null=True,
blank=True,
help_text="Phone",
)
address_line = models.TextField(
address_line = models.CharField(
null=True,
blank=True,
help_text="Street address",
)
city = models.TextField(
city = models.CharField(
null=True,
blank=True,
help_text="City",
Expand Down

0 comments on commit b355f18

Please sign in to comment.