-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Enrollment Flow for consistent labeling across apps (#2403)
- Changes the implementation of the relationship between EnrollmentFlow and TransitAgency models. EnrollmentFlow now has a TransitAgency foreign key field (many flows to one transit agency). EnrollmentFlow's agency is not required and can be blank. - Updates EnrollmentFlow labels in fixture data, to match the names used in form fields. - Updates Admin view for EnrollmentFlow to show more relevant information. - Adds data migration, updates fixtures, tests, help text.
- Loading branch information
Showing
8 changed files
with
245 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
benefits/core/migrations/0028_remove_transitagency_enrollment_flows_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Generated by Django 5.1 on 2024-09-30 23:25 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
def migrate_data(apps, schema_editor): | ||
TransitAgency = apps.get_model("core", "TransitAgency") | ||
for agency in TransitAgency.objects.all(): | ||
for flow in agency.enrollment_flows.all(): | ||
flow.transit_agency = agency | ||
flow.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("core", "0027_enrollmentflow_supported_methods"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="enrollmentflow", | ||
name="transit_agency", | ||
field=models.ForeignKey( | ||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to="core.transitagency" | ||
), | ||
), | ||
migrations.RunPython(migrate_data), | ||
migrations.RemoveField( | ||
model_name="transitagency", | ||
name="enrollment_flows", | ||
), | ||
migrations.AlterField( | ||
model_name="enrollmentflow", | ||
name="label", | ||
field=models.TextField(help_text="A human readable label, used as the display text in Admin.", null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.