From f3251226febd8f472a898e2fc68c4dfb8d4fc50e Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Sat, 17 Aug 2019 14:09:23 +0200 Subject: [PATCH] Allow NULL in unique charfields. --- biscuit/core/migrations/0012_allow_null.py | 23 ++++++++++++++++++++++ biscuit/core/models.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 biscuit/core/migrations/0012_allow_null.py diff --git a/biscuit/core/migrations/0012_allow_null.py b/biscuit/core/migrations/0012_allow_null.py new file mode 100644 index 000000000..641fca030 --- /dev/null +++ b/biscuit/core/migrations/0012_allow_null.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.4 on 2019-08-17 12:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0011_default_school'), + ] + + operations = [ + migrations.AlterField( + model_name='person', + name='import_ref', + field=models.CharField(blank=True, editable=False, max_length=64, null=True, verbose_name='Reference ID of import source'), + ), + migrations.AlterField( + model_name='person', + name='short_name', + field=models.CharField(blank=True, max_length=5, null=True, verbose_name='Short name'), + ), + ] diff --git a/biscuit/core/models.py b/biscuit/core/models.py index 6c5498a10..8ec067713 100644 --- a/biscuit/core/models.py +++ b/biscuit/core/models.py @@ -44,7 +44,7 @@ class Person(SchoolRelated): 'Additional name(s)'), max_length=30, blank=True) short_name = models.CharField(verbose_name=_( - 'Short name'), max_length=5, blank=True) + 'Short name'), max_length=5, blank=True, null=True) street = models.CharField(verbose_name=_( 'Street'), max_length=30, blank=True) @@ -69,7 +69,7 @@ class Person(SchoolRelated): photo = models.ImageField(verbose_name=_('Photo'), blank=True, null=True) import_ref = models.CharField(verbose_name=_( - 'Reference ID of import source'), max_length=64, blank=True, editable=False) + 'Reference ID of import source'), max_length=64, blank=True, null=True, editable=False) guardians = models.ManyToManyField('self', verbose_name=_('Guardians / Parents'), symmetrical=False, related_name='children') -- GitLab