From 64b8f0ee108a966aabb317c8e627960854397a92 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Tue, 11 Aug 2020 10:16:53 +0200 Subject: [PATCH] the old NullBooleanField defaulted to blank=True, BooleanField with null=True does not, TIL --- .../migrations/0013_auto_20200811_1015.py | 33 +++++++++++++++++++ src/economy/models.py | 2 ++ .../migrations/0098_auto_20200811_1015.py | 32 ++++++++++++++++++ src/program/models.py | 2 ++ .../migrations/0062_auto_20200811_1015.py | 24 ++++++++++++++ src/shop/models.py | 1 + 6 files changed, 94 insertions(+) create mode 100644 src/economy/migrations/0013_auto_20200811_1015.py create mode 100644 src/program/migrations/0098_auto_20200811_1015.py create mode 100644 src/shop/migrations/0062_auto_20200811_1015.py diff --git a/src/economy/migrations/0013_auto_20200811_1015.py b/src/economy/migrations/0013_auto_20200811_1015.py new file mode 100644 index 00000000..887957f4 --- /dev/null +++ b/src/economy/migrations/0013_auto_20200811_1015.py @@ -0,0 +1,33 @@ +# Generated by Django 3.1 on 2020-08-11 08:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("economy", "0012_auto_20200811_0233"), + ] + + operations = [ + migrations.AlterField( + model_name="expense", + name="approved", + field=models.BooleanField( + blank=True, + default=None, + help_text="True if this expense has been approved by the responsible team. False if it has been rejected. Blank if noone has decided yet.", + null=True, + ), + ), + migrations.AlterField( + model_name="revenue", + name="approved", + field=models.BooleanField( + blank=True, + default=None, + help_text="True if this Revenue has been approved by the responsible team. False if it has been rejected. Blank if noone has decided yet.", + null=True, + ), + ), + ] diff --git a/src/economy/models.py b/src/economy/models.py index 20850cb6..3ebfc009 100644 --- a/src/economy/models.py +++ b/src/economy/models.py @@ -216,6 +216,7 @@ class Revenue(CampRelatedModel, UUIDModel): ) approved = models.BooleanField( + blank=True, null=True, default=None, help_text="True if this Revenue has been approved by the responsible team. False if it has been rejected. Blank if noone has decided yet.", @@ -339,6 +340,7 @@ class Expense(CampRelatedModel, UUIDModel): ) approved = models.BooleanField( + blank=True, null=True, default=None, help_text="True if this expense has been approved by the responsible team. False if it has been rejected. Blank if noone has decided yet.", diff --git a/src/program/migrations/0098_auto_20200811_1015.py b/src/program/migrations/0098_auto_20200811_1015.py new file mode 100644 index 00000000..5de1b5aa --- /dev/null +++ b/src/program/migrations/0098_auto_20200811_1015.py @@ -0,0 +1,32 @@ +# Generated by Django 3.1 on 2020-08-11 08:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("program", "0097_auto_20200811_0233"), + ] + + operations = [ + migrations.AlterField( + model_name="eventfeedback", + name="approved", + field=models.BooleanField( + blank=True, + help_text="Approve feedback? It will not be visible to the Event owner before it is approved.", + null=True, + ), + ), + migrations.AlterField( + model_name="eventslot", + name="autoscheduled", + field=models.BooleanField( + blank=True, + default=None, + help_text="True if the Event was scheduled by the AutoScheduler, False if it was scheduled manually, None if there is nothing scheduled in this EventSlot.", + null=True, + ), + ), + ] diff --git a/src/program/models.py b/src/program/models.py index f3ff24f0..ce8d8eee 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -1048,6 +1048,7 @@ class EventSlot(CampRelatedModel): ) autoscheduled = models.BooleanField( + blank=True, null=True, default=None, help_text="True if the Event was scheduled by the AutoScheduler, False if it was scheduled manually, None if there is nothing scheduled in this EventSlot.", @@ -1654,6 +1655,7 @@ class EventFeedback(CampRelatedModel, UUIDModel): comment = models.TextField(blank=True, help_text="Any other comments or feedback?") approved = models.BooleanField( + blank=True, null=True, help_text="Approve feedback? It will not be visible to the Event owner before it is approved.", ) diff --git a/src/shop/migrations/0062_auto_20200811_1015.py b/src/shop/migrations/0062_auto_20200811_1015.py new file mode 100644 index 00000000..e4e2f107 --- /dev/null +++ b/src/shop/migrations/0062_auto_20200811_1015.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1 on 2020-08-11 08:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("shop", "0061_auto_20200811_0233"), + ] + + operations = [ + migrations.AlterField( + model_name="order", + name="open", + field=models.BooleanField( + blank=True, + default=True, + help_text='Whether this shop order is open or not. "None" means closed.', + null=True, + verbose_name="Open?", + ), + ), + ] diff --git a/src/shop/models.py b/src/shop/models.py index 9f39bfb6..7e849723 100644 --- a/src/shop/models.py +++ b/src/shop/models.py @@ -77,6 +77,7 @@ class Order(CreatedUpdatedModel): # We are using a nullable BooleanField here to ensure that we only have one open order per user at a time. # This "hack" is possible since postgres treats null values as different, and thus we have database level integrity. open = models.BooleanField( + blank=True, null=True, verbose_name=_("Open?"), help_text=_('Whether this shop order is open or not. "None" means closed.'),