model/migration fix

This commit is contained in:
CocoByte 2024-06-21 13:32:33 -06:00
parent 1cb6dda7fb
commit 87a9a3f9d6
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
4 changed files with 9 additions and 22 deletions

View file

@ -1017,7 +1017,7 @@ class ContactAdmin(ListHeaderAdmin, ImportExportModelAdmin):
return super().changelist_view(request, extra_context=extra_context)
class SeniorOfficialAdmin(ListHeaderAdmin, ImportExportModelAdmin):
class SeniorOfficialAdmin(ListHeaderAdmin):
"""Custom Senior Official Admin class."""
# NOTE: these are just placeholders. Not part of ACs (haven't been defined yet). Update in future tickets.
@ -1031,13 +1031,6 @@ class SeniorOfficialAdmin(ListHeaderAdmin, ImportExportModelAdmin):
# in autocomplete_fields for user
ordering = ["first_name", "last_name"]
fieldsets = [
(
None,
{"fields": ["first_name", "last_name", "title", "phone"]},
)
]
class WebsiteResource(resources.ModelResource):
"""defines how each field in the referenced model should be mapped to the corresponding fields in the

View file

@ -1,9 +1,8 @@
# Generated by Django 4.2.10 on 2024-06-20 21:16
# Generated by Django 4.2.10 on 2024-06-21 19:26
from django.db import migrations, models
import django.db.models.deletion
import phonenumber_field.modelfields
import registrar.models.federal_agency
class Migration(migrations.Migration):
@ -27,13 +26,17 @@ class Migration(migrations.Migration):
phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None),
),
],
options={
"abstract": False,
},
),
migrations.AddField(
model_name="portfolio",
name="senior_official",
field=models.ForeignKey(
default=registrar.models.federal_agency.FederalAgency.get_non_federal_agency,
blank=True,
help_text="Associated senior official",
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="registrar.seniorofficial",
),

View file

@ -43,7 +43,8 @@ class Portfolio(TimeStampedModel):
on_delete=models.PROTECT,
help_text="Associated senior official",
unique=False,
default=FederalAgency.get_non_federal_agency,
null=True,
blank=True
)
organization_type = models.CharField(

View file

@ -11,16 +11,6 @@ class SeniorOfficial(TimeStampedModel):
managing Portfolios.
"""
class Meta:
"""Contains meta information about this class"""
# Placeholder for later tickets...
# indexes = [
# models.Index(fields=["user"]),
# models.Index(fields=["email"]),
# ]
first_name = models.CharField(
null=False,
blank=False,