Skip to content

Commit

Permalink
🔀 [#2041] Fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Mar 11, 2024
1 parent c9fb425 commit d0b594f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Generated by Django 3.2.23 on 2024-01-25 11:27
# Generated by Django 4.2.10 on 2024-03-04 11:46

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("accounts", "0070_auto_20231205_1657"),
("accounts", "0074_merge_20240228_1544"),
]

operations = [
Expand Down Expand Up @@ -73,16 +73,4 @@ class Migration(migrations.Migration):
name="check_kvk_or_rsin_only_set_when_login_eherkenning",
),
),
migrations.AddConstraint(
model_name="user",
constraint=models.CheckConstraint(
check=models.Q(
models.Q(("kvk", ""), models.Q(("rsin", ""), _negated=True)),
models.Q(models.Q(("kvk", ""), _negated=True), ("rsin", "")),
models.Q(("login_type", "eherkenning"), _negated=True),
_connector="OR",
),
name="check_kvk_or_rsin_exclusive_when_login_eherkenning",
),
),
]
12 changes: 6 additions & 6 deletions src/open_inwoner/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q, UniqueConstraint
from django.db.models import CheckConstraint, Q, UniqueConstraint
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string
Expand Down Expand Up @@ -278,11 +278,11 @@ class Meta:
| Q(login_type=LoginTypeChoices.eherkenning),
name="check_kvk_or_rsin_only_set_when_login_eherkenning",
),
CheckConstraint(
check=((Q(kvk="") & ~Q(rsin="")) | (~Q(kvk="") & Q(rsin="")))
| ~Q(login_type=LoginTypeChoices.eherkenning),
name="check_kvk_or_rsin_exclusive_when_login_eherkenning",
),
# CheckConstraint(
# check=((Q(kvk="") & ~Q(rsin="")) | (~Q(kvk="") & Q(rsin="")))
# | ~Q(login_type=LoginTypeChoices.eherkenning),
# name="check_kvk_or_rsin_exclusive_when_login_eherkenning",
# ),
]

def __init__(self, *args, **kwargs):
Expand Down

0 comments on commit d0b594f

Please sign in to comment.