fix django3.1 compatibility

This commit is contained in:
Thomas Steen Rasmussen 2020-08-11 02:35:18 +02:00
parent 001ba2d955
commit db20fd7b68
6 changed files with 125 additions and 14 deletions

View file

@ -0,0 +1,31 @@
# Generated by Django 3.1 on 2020-08-11 00:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("economy", "0011_pos_posreport"),
]
operations = [
migrations.AlterField(
model_name="expense",
name="approved",
field=models.BooleanField(
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(
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

@ -215,7 +215,8 @@ class Revenue(CampRelatedModel, UUIDModel):
help_text="The team to which this revenue belongs. When in doubt pick the Economy team.", help_text="The team to which this revenue belongs. When in doubt pick the Economy team.",
) )
approved = models.NullBooleanField( approved = models.BooleanField(
null=True,
default=None, 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.", 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.",
) )
@ -337,7 +338,8 @@ class Expense(CampRelatedModel, UUIDModel):
help_text="The team to which this Expense belongs. A team responsible will need to approve the expense. When in doubt pick the Economy team.", help_text="The team to which this Expense belongs. A team responsible will need to approve the expense. When in doubt pick the Economy team.",
) )
approved = models.NullBooleanField( approved = models.BooleanField(
null=True,
default=None, 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.", 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,30 @@
# Generated by Django 3.1 on 2020-08-11 00:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("program", "0096_auto_20200810_2034"),
]
operations = [
migrations.AlterField(
model_name="eventfeedback",
name="approved",
field=models.BooleanField(
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(
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

@ -1047,7 +1047,8 @@ class EventSlot(CampRelatedModel):
help_text="The Event scheduled in this EventSlot", help_text="The Event scheduled in this EventSlot",
) )
autoscheduled = models.NullBooleanField( autoscheduled = models.BooleanField(
null=True,
default=None, 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.", 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.",
) )
@ -1652,8 +1653,9 @@ class EventFeedback(CampRelatedModel, UUIDModel):
comment = models.TextField(blank=True, help_text="Any other comments or feedback?") comment = models.TextField(blank=True, help_text="Any other comments or feedback?")
approved = models.NullBooleanField( approved = models.BooleanField(
help_text="Approve feedback? It will not be visible to the Event owner before it is approved." null=True,
help_text="Approve feedback? It will not be visible to the Event owner before it is approved.",
) )
@property @property

View file

@ -0,0 +1,45 @@
# Generated by Django 3.1 on 2020-08-11 00:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("shop", "0060_productcategory_weight"),
]
operations = [
migrations.AlterField(
model_name="coinifyapicallback", name="headers", field=models.JSONField(),
),
migrations.AlterField(
model_name="coinifyapicallback",
name="payload",
field=models.JSONField(blank=True),
),
migrations.AlterField(
model_name="coinifyapiinvoice",
name="invoicejson",
field=models.JSONField(),
),
migrations.AlterField(
model_name="coinifyapirequest", name="payload", field=models.JSONField(),
),
migrations.AlterField(
model_name="coinifyapirequest", name="response", field=models.JSONField(),
),
migrations.AlterField(
model_name="epaycallback", name="payload", field=models.JSONField(),
),
migrations.AlterField(
model_name="order",
name="open",
field=models.BooleanField(
default=True,
help_text='Whether this shop order is open or not. "None" means closed.',
null=True,
verbose_name="Open?",
),
),
]

View file

@ -4,7 +4,7 @@ from decimal import Decimal
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.postgres.fields import DateTimeRangeField, JSONField from django.contrib.postgres.fields import DateTimeRangeField
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.db.models.aggregates import Sum from django.db.models.aggregates import Sum
@ -74,9 +74,10 @@ class Order(CreatedUpdatedModel):
default=False, default=False,
) )
# We are using a NullBooleanField here to ensure that we only have one open order per user at a time. # 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. # This "hack" is possible since postgres treats null values as different, and thus we have database level integrity.
open = models.NullBooleanField( open = models.BooleanField(
null=True,
verbose_name=_("Open?"), verbose_name=_("Open?"),
help_text=_('Whether this shop order is open or not. "None" means closed.'), help_text=_('Whether this shop order is open or not. "None" means closed.'),
default=True, default=True,
@ -518,7 +519,7 @@ class EpayCallback(CreatedUpdatedModel, UUIDModel):
verbose_name_plural = "Epay Callbacks" verbose_name_plural = "Epay Callbacks"
ordering = ["-created"] ordering = ["-created"]
payload = JSONField() payload = models.JSONField()
md5valid = models.BooleanField(default=False) md5valid = models.BooleanField(default=False)
def __str__(self): def __str__(self):
@ -652,7 +653,7 @@ class Invoice(CreatedUpdatedModel):
class CoinifyAPIInvoice(CreatedUpdatedModel): class CoinifyAPIInvoice(CreatedUpdatedModel):
coinify_id = models.IntegerField(null=True) coinify_id = models.IntegerField(null=True)
invoicejson = JSONField() invoicejson = models.JSONField()
order = models.ForeignKey( order = models.ForeignKey(
"shop.Order", related_name="coinify_api_invoices", on_delete=models.PROTECT "shop.Order", related_name="coinify_api_invoices", on_delete=models.PROTECT
) )
@ -666,8 +667,8 @@ class CoinifyAPIInvoice(CreatedUpdatedModel):
class CoinifyAPICallback(CreatedUpdatedModel): class CoinifyAPICallback(CreatedUpdatedModel):
headers = JSONField() headers = models.JSONField()
payload = JSONField(blank=True) payload = models.JSONField(blank=True)
body = models.TextField(default="") body = models.TextField(default="")
order = models.ForeignKey( order = models.ForeignKey(
"shop.Order", related_name="coinify_api_callbacks", on_delete=models.PROTECT "shop.Order", related_name="coinify_api_callbacks", on_delete=models.PROTECT
@ -683,8 +684,8 @@ class CoinifyAPIRequest(CreatedUpdatedModel):
"shop.Order", related_name="coinify_api_requests", on_delete=models.PROTECT "shop.Order", related_name="coinify_api_requests", on_delete=models.PROTECT
) )
method = models.CharField(max_length=100) method = models.CharField(max_length=100)
payload = JSONField() payload = models.JSONField()
response = JSONField() response = models.JSONField()
def __str__(self): def __str__(self):
return "order %s api request %s" % (self.order.id, self.method) return "order %s api request %s" % (self.order.id, self.method)