From fd1bb8fb51c3e5e765eeae057f896452150fd147 Mon Sep 17 00:00:00 2001
From: Tom Teichler <tom.teichler@teckids.org>
Date: Wed, 15 Dec 2021 22:30:55 +0100
Subject: [PATCH] Remove null=True from not unique CharFields

---
 .../migrations/0028_char_field_not_null.py    | 25 +++++++++++++++++++
 aleksis/core/models.py                        |  6 ++---
 2 files changed, 27 insertions(+), 4 deletions(-)
 create mode 100644 aleksis/core/migrations/0028_char_field_not_null.py

diff --git a/aleksis/core/migrations/0028_char_field_not_null.py b/aleksis/core/migrations/0028_char_field_not_null.py
new file mode 100644
index 000000000..76c715e03
--- /dev/null
+++ b/aleksis/core/migrations/0028_char_field_not_null.py
@@ -0,0 +1,25 @@
+# Generated by Django 3.2.10 on 2021-12-15 21:10
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('core', '0027_person_place_of_birth'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='oauthapplication',
+            name='authorization_grant_type',
+            field=models.CharField(blank=True, choices=[('authorization-code', 'Authorization code'), ('implicit', 'Implicit'), ('password', 'Resource owner password-based'), ('client-credentials', 'Client credentials'), ('openid-hybrid', 'OpenID connect hybrid')], default='', max_length=32),
+            preserve_default=False,
+        ),
+        migrations.AlterField(
+            model_name='person',
+            name='place_of_birth',
+            field=models.CharField(blank=True, default='', max_length=255, verbose_name='Place of birth'),
+            preserve_default=False,
+        ),
+    ]
diff --git a/aleksis/core/models.py b/aleksis/core/models.py
index 3ce728b7c..8a8ec40af 100644
--- a/aleksis/core/models.py
+++ b/aleksis/core/models.py
@@ -194,9 +194,7 @@ class Person(ExtensibleModel):
     email = models.EmailField(verbose_name=_("E-mail address"), blank=True)
 
     date_of_birth = models.DateField(verbose_name=_("Date of birth"), blank=True, null=True)
-    place_of_birth = models.CharField(
-        verbose_name=_("Place of birth"), max_length=255, blank=True, null=True
-    )
+    place_of_birth = models.CharField(verbose_name=_("Place of birth"), max_length=255, blank=True)
     sex = models.CharField(verbose_name=_("Sex"), max_length=1, choices=SEX_CHOICES, blank=True)
 
     photo = models.ImageField(verbose_name=_("Photo"), blank=True, null=True)
@@ -1118,7 +1116,7 @@ class OAuthApplication(AbstractApplication):
 
     # Override grant types to make field optional
     authorization_grant_type = models.CharField(
-        max_length=32, choices=AbstractApplication.GRANT_TYPES, blank=True, null=True
+        max_length=32, choices=AbstractApplication.GRANT_TYPES, blank=True
     )
 
     # Optional list of alloewd scopes
-- 
GitLab