Populate fed agency seed data

This commit is contained in:
Erin 2024-03-19 14:40:36 -07:00
parent 7b5beba813
commit d62e95fd10
No known key found for this signature in database
GPG key ID: 1CAD275313C62460
2 changed files with 15 additions and 0 deletions

View file

@ -1,7 +1,14 @@
# Generated by Django 4.2.10 on 2024-03-19 05:42
# This migration seeds the federal agency table with initial data and manually calls
# FederalAgency.create_federal_agencies to populate initial table values.
from django.db import migrations, models
from registrar.models import FederalAgency
from typing import Any
# For linting: RunPython expects a function reference.
def create_federal_agencies(apps, schema_editor) -> Any:
FederalAgency.create_federal_agencies(apps, schema_editor)
class Migration(migrations.Migration):
@ -23,4 +30,9 @@ class Migration(migrations.Migration):
"verbose_name_plural": "Federal agencies",
},
),
migrations.RunPython(
create_federal_agencies,
reverse_code=migrations.RunPython.noop,
atomic=True,
),
]

View file

@ -17,6 +17,9 @@ class FederalAgency(TimeStampedModel):
help_text="Federal agency",
)
def __str__(self) -> str:
return self.agency
# TODO: Update parameters to put in
def create_federal_agencies(apps, schema_editor):
"""This method gets run from a data migration."""