Skip to content

Commit fd19388

Browse files
authored
Merge pull request #1838 from webkom/feat-make-membership-multi-role
Add support for multiple roles
2 parents 085485a + b5f8f70 commit fd19388

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 5.1.5 on 2025-03-14 00:36
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("admissions", "0001_initial"),
10+
]
11+
12+
operations = [
13+
migrations.RemoveConstraint(
14+
model_name="membership",
15+
name="unique_user_group_combination",
16+
),
17+
migrations.AddConstraint(
18+
model_name="membership",
19+
constraint=models.UniqueConstraint(
20+
fields=("user", "group", "role"), name="unique_user_group_role"
21+
),
22+
),
23+
]

admissions/admissions/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ class Membership(models.Model):
165165
class Meta:
166166
constraints = [
167167
models.UniqueConstraint(
168-
fields=["user", "group"],
169-
name="unique_user_group_combination",
168+
fields=["user", "group", "role"], name="unique_user_group_role"
170169
)
171170
]
172171

0 commit comments

Comments
 (0)