From 53ea1288c103846eadadc03bfab790acccfaa6c6 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 10 Feb 2020 17:41:05 +0100 Subject: [PATCH] ISBN is unique --- media/migrations/0026_auto_20200210_1740.py | 20 ++++++++++++++++++++ media/models.py | 1 + 2 files changed, 21 insertions(+) create mode 100644 media/migrations/0026_auto_20200210_1740.py diff --git a/media/migrations/0026_auto_20200210_1740.py b/media/migrations/0026_auto_20200210_1740.py new file mode 100644 index 0000000..1a89523 --- /dev/null +++ b/media/migrations/0026_auto_20200210_1740.py @@ -0,0 +1,20 @@ +# Generated by Django 2.2.4 on 2020-02-10 16:40 + +from django.db import migrations +import media.fields +import media.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ('media', '0025_auteur_note'), + ] + + operations = [ + migrations.AlterField( + model_name='media', + name='isbn', + field=media.fields.ISBNField(blank=True, help_text='You may be able to scan it from a bar code.', max_length=28, null=True, unique=True, validators=[media.validators.isbn_validator], verbose_name='ISBN'), + ), + ] diff --git a/media/models.py b/media/models.py index bad1c1d..dbfaf04 100644 --- a/media/models.py +++ b/media/models.py @@ -34,6 +34,7 @@ class Media(models.Model): isbn = ISBNField( _('ISBN'), help_text=_('You may be able to scan it from a bar code.'), + unique=True, blank=True, null=True, )