From d0b594f4ec2a1405cc0fc490481fc3130fe35a62 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Fri, 23 Feb 2024 16:43:36 +0100 Subject: [PATCH] :twisted_rightwards_arrows: [#2041] Fixes after rebase --- ...user_unique_bsn_when_login_digid_and_more.py} | 16 ++-------------- src/open_inwoner/accounts/models.py | 12 ++++++------ 2 files changed, 8 insertions(+), 20 deletions(-) rename src/open_inwoner/accounts/migrations/{0071_auto_20240125_1227.py => 0075_user_unique_bsn_when_login_digid_and_more.py} (79%) diff --git a/src/open_inwoner/accounts/migrations/0071_auto_20240125_1227.py b/src/open_inwoner/accounts/migrations/0075_user_unique_bsn_when_login_digid_and_more.py similarity index 79% rename from src/open_inwoner/accounts/migrations/0071_auto_20240125_1227.py rename to src/open_inwoner/accounts/migrations/0075_user_unique_bsn_when_login_digid_and_more.py index 9869487bb6..773bea5a48 100644 --- a/src/open_inwoner/accounts/migrations/0071_auto_20240125_1227.py +++ b/src/open_inwoner/accounts/migrations/0075_user_unique_bsn_when_login_digid_and_more.py @@ -1,4 +1,4 @@ -# 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 @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ("accounts", "0070_auto_20231205_1657"), + ("accounts", "0074_merge_20240228_1544"), ] operations = [ @@ -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", - ), - ), ] diff --git a/src/open_inwoner/accounts/models.py b/src/open_inwoner/accounts/models.py index c95d749bb1..bb8d62528a 100644 --- a/src/open_inwoner/accounts/models.py +++ b/src/open_inwoner/accounts/models.py @@ -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 @@ -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):