diff --git a/src/pretix/base/migrations/0215_customer_organizer_identifier_unique.py b/src/pretix/base/migrations/0215_customer_organizer_identifier_unique.py new file mode 100644 index 0000000000..6d7ec776a3 --- /dev/null +++ b/src/pretix/base/migrations/0215_customer_organizer_identifier_unique.py @@ -0,0 +1,22 @@ +# Generated by Django 3.2.12 on 2022-05-12 15:34 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('pretixbase', '0214_customer_notes_ext_id'), + ] + + operations = [ + migrations.AlterField( + model_name='customer', + name='identifier', + field=models.CharField(db_index=True, max_length=190), + ), + migrations.AlterUniqueTogether( + name='customer', + unique_together={('organizer', 'email'), ('organizer', 'identifier')}, + ), + ] diff --git a/src/pretix/base/models/customers.py b/src/pretix/base/models/customers.py index b610ada0c3..488f7c8fa8 100644 --- a/src/pretix/base/models/customers.py +++ b/src/pretix/base/models/customers.py @@ -48,7 +48,6 @@ class Customer(LoggedModel): identifier = models.CharField( max_length=190, db_index=True, - unique=True, help_text=_('You can enter any value here to make it easier to match the data with other sources. If you do ' 'not input one, we will generate one automatically.'), validators=[ @@ -78,7 +77,7 @@ class Customer(LoggedModel): objects = ScopedManager(organizer='organizer') class Meta: - unique_together = [['organizer', 'email']] + unique_together = [['organizer', 'email'], ['organizer', 'identifier']] ordering = ('email',) def get_email_field_name(self):