Skip to content

Commit

Permalink
feat(model): add group field to TransitAgency
Browse files Browse the repository at this point in the history
this allows us to link a user in the admin interface to a TransitAgency
  • Loading branch information
angela-tran committed Aug 16, 2024
1 parent a6536cd commit e00240c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
27 changes: 27 additions & 0 deletions benefits/core/migrations/0022_transitagency_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.0.7 on 2024-08-16 16:08

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
("core", "0021_rename_eligibilityverifier_enrollmentflow"),
]

operations = [
migrations.AddField(
model_name="transitagency",
name="group",
field=models.OneToOneField(
blank=True,
default=None,
help_text="The group of users who can access this TransitAgency.",
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="auth.group",
),
),
]
9 changes: 9 additions & 0 deletions benefits/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from django.conf import settings
from django.core.exceptions import ValidationError
from django.contrib.auth.models import Group
from django.db import models
from django.urls import reverse

Expand Down Expand Up @@ -352,6 +353,14 @@ class TransitAgency(models.Model):
help_text="The name of the secret containing this agency's client_secret value used to access the TransitProcessor's API.", # noqa: E501
default="",
)
group = models.OneToOneField(
Group,
on_delete=models.PROTECT,
null=True,
blank=True,
default=None,
help_text="The group of users who can access this TransitAgency.",
)

def __str__(self):
return self.long_name
Expand Down

0 comments on commit e00240c

Please sign in to comment.