Model updates and cleanup of comments

This commit is contained in:
CocoByte 2024-06-17 21:20:05 -06:00
parent 2c96eebc6f
commit 42efc73722
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
5 changed files with 17 additions and 25 deletions

View file

@ -2562,9 +2562,11 @@ class PortfolioAdmin(ListHeaderAdmin):
# ]
def save_model(self, request, obj, form, change):
# ---- update creator ----
# Set the creator field to the current admin user
obj.creator = request.user if request.user.is_authenticated else None
if not obj.creator is None:
# ---- update creator ----
# Set the creator field to the current admin user
obj.creator = request.user if request.user.is_authenticated else None
# ---- update organization name ----
# org name will be the same as federal agency, if it is federal,

View file

@ -1,4 +1,4 @@
# Generated by Django 4.2.10 on 2024-06-17 19:47
# Generated by Django 4.2.10 on 2024-06-18 03:19
from django.conf import settings
from django.db import migrations, models
@ -150,7 +150,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="domaininformation",
name="portfolio",
field=models.OneToOneField(
field=models.ForeignKey(
blank=True,
help_text="Portfolio associated with this domain",
null=True,
@ -162,7 +162,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="domainrequest",
name="portfolio",
field=models.OneToOneField(
field=models.ForeignKey(
blank=True,
help_text="Portfolio associated with this domain request",
null=True,

View file

@ -58,7 +58,7 @@ class DomainInformation(TimeStampedModel):
)
# portfolio
portfolio = models.OneToOneField(
portfolio = models.ForeignKey(
"registrar.Portfolio",
on_delete=models.PROTECT,
null=True,

View file

@ -304,7 +304,7 @@ class DomainRequest(TimeStampedModel):
)
# portfolio
portfolio = models.OneToOneField(
portfolio = models.ForeignKey(
"registrar.Portfolio",
on_delete=models.PROTECT,
null=True,

View file

@ -21,18 +21,15 @@ class Portfolio(TimeStampedModel):
OrganizationChoices = DomainRequest.OrganizationChoices
StateTerritoryChoices = DomainRequest.StateTerritoryChoices
# creator - stores who created this model. If no creator is specified in DJA,
# Stores who created this model. If no creator is specified in DJA,
# then the creator will default to the current request user"""
creator = models.ForeignKey("registrar.User", on_delete=models.PROTECT, help_text="Associated user", unique=False)
# notes - text field (copies what is done on domain requests)
notes = models.TextField(
null=True,
blank=True,
)
# federal agency - FK to fed agency table (Not nullable, should default
# to the Non-federal agency value in the fed agency table)
federal_agency = models.ForeignKey(
"registrar.FederalAgency",
on_delete=models.PROTECT,
@ -41,7 +38,6 @@ class Portfolio(TimeStampedModel):
default=get_default_federal_agency,
)
# organization type - should match organization types allowed on domain info
organization_type = models.CharField(
max_length=255,
choices=OrganizationChoices.choices,
@ -50,34 +46,29 @@ class Portfolio(TimeStampedModel):
help_text="Type of organization",
)
# organization name
# NOTE: org name will be the same as federal agency, if it is federal,
# otherwise it will be the actual org name. If nothing is entered for
# org name and it is a federal organization, have this field fill with
# the federal agency text name.
organization_name = models.CharField(
null=True,
blank=True,
)
# address_line1
address_line1 = models.CharField(
null=True,
blank=True,
verbose_name="address line 1",
)
# address_line2
address_line2 = models.CharField(
null=True,
blank=True,
verbose_name="address line 2",
)
# city
city = models.CharField(
null=True,
blank=True,
)
# state (copied from domain_request.py -- imports enums from domain_request.py)
# (imports enums from domain_request.py)
state_territory = models.CharField(
max_length=2,
choices=StateTerritoryChoices.choices,
@ -85,14 +76,14 @@ class Portfolio(TimeStampedModel):
blank=True,
verbose_name="state / territory",
)
# zipcode
zipcode = models.CharField(
max_length=10,
null=True,
blank=True,
verbose_name="zip code",
)
# urbanization
urbanization = models.CharField(
null=True,
blank=True,
@ -100,7 +91,6 @@ class Portfolio(TimeStampedModel):
verbose_name="urbanization",
)
# security_contact_email
security_contact_email = models.EmailField(
null=True,
blank=True,