the old NullBooleanField defaulted to blank=True, BooleanField with null=True does not, TIL

This commit is contained in:
Thomas Steen Rasmussen 2020-08-11 10:16:53 +02:00
parent d61b03b822
commit 64b8f0ee10
6 changed files with 94 additions and 0 deletions

View file

@ -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,
),
),
]

View file

@ -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.",

View file

@ -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,
),
),
]

View file

@ -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.",
)

View file

@ -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?",
),
),
]

View file

@ -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.'),