Verified Commit bd100399 authored by VAN ZUIJLEN Nils's avatar VAN ZUIJLEN Nils
Browse files

Do necessary changes for new version

Add some typing
Specify default db pk field, kept the default to keep the same value as
before as pk migration are not generated
parent cb28ffcf
...@@ -27,7 +27,7 @@ class OrderItemForm(forms.ModelForm): ...@@ -27,7 +27,7 @@ class OrderItemForm(forms.ModelForm):
def __init__(self, item=None, *args, **kwargs) -> None: def __init__(self, item=None, *args, **kwargs) -> None:
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
instance = getattr(self, "instance", None) instance = getattr(self, "instance")
if item is None: if item is None:
item = instance.item item = instance.item
......
...@@ -2,6 +2,7 @@ import csv ...@@ -2,6 +2,7 @@ import csv
import json import json
from typing import Any from typing import Any
from typing import Dict from typing import Dict
from typing import Optional
from typing import Type from typing import Type
from django.contrib import messages from django.contrib import messages
...@@ -529,7 +530,7 @@ class DeliveryView(PermissionRequiredMixin, ListView): ...@@ -529,7 +530,7 @@ class DeliveryView(PermissionRequiredMixin, ListView):
order__payment__paid=True, order__payment__paid=True,
).select_related("order__user__profile", "order__user", "item") ).select_related("order__user__profile", "order__user", "item")
def boolQueryParam(self, param): def boolQueryParam(self, param: str) -> Optional[bool]:
if param == 'true': if param == 'true':
return True return True
if param == 'false': if param == 'false':
...@@ -539,7 +540,7 @@ class DeliveryView(PermissionRequiredMixin, ListView): ...@@ -539,7 +540,7 @@ class DeliveryView(PermissionRequiredMixin, ListView):
def options(self, request: HttpRequest, *args: Any, **kwargs: Any) -> JsonResponse: def options(self, request: HttpRequest, *args: Any, **kwargs: Any) -> JsonResponse:
itemList = OrderItem.objects itemList = OrderItem.objects.all()
delivered = self.boolQueryParam(request.GET["delivered"]) delivered = self.boolQueryParam(request.GET["delivered"])
if delivered is False: if delivered is False:
......
...@@ -108,6 +108,8 @@ DATABASES = { ...@@ -108,6 +108,8 @@ DATABASES = {
} }
} }
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
FIXTURE_DIRS = ("fixtures/",) FIXTURE_DIRS = ("fixtures/",)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment