From 566d3ac90d3842329ff35382f85e8331d6306d05 Mon Sep 17 00:00:00 2001 From: Lars van Rhijn Date: Sun, 28 Apr 2024 21:59:35 +0200 Subject: [PATCH] Move status screen to its own app --- pyproject.toml | 6 +++--- ...y => 0003_order_picked_up_order_picked_up_at.py} | 5 +++-- website/orders/urls.py | 1 - website/orders/views.py | 11 ----------- website/status_screen/__init__.py | 0 website/status_screen/apps.py | 8 ++++++++ website/status_screen/migrations/__init__.py | 0 .../static/status_screen}/css/status-screen.css | 0 .../templates/status_screen}/status_screen.html | 2 +- website/status_screen/urls.py | 7 +++++++ website/status_screen/views.py | 13 +++++++++++++ website/tosti/settings/base.py | 6 ++++-- website/tosti/urls.py | 4 ++++ 13 files changed, 43 insertions(+), 20 deletions(-) rename website/orders/migrations/{0009_order_picked_up_order_picked_up_at.py => 0003_order_picked_up_order_picked_up_at.py} (83%) create mode 100644 website/status_screen/__init__.py create mode 100644 website/status_screen/apps.py create mode 100644 website/status_screen/migrations/__init__.py rename website/{orders/static/orders => status_screen/static/status_screen}/css/status-screen.css (100%) rename website/{orders/templates/orders => status_screen/templates/status_screen}/status_screen.html (98%) create mode 100644 website/status_screen/urls.py create mode 100644 website/status_screen/views.py diff --git a/pyproject.toml b/pyproject.toml index a729fcb8..3aef89a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ sentry-sdk = "^1.14.0" [tool.black] line-length = 119 -target-version = ["py310"] +target-version = ["py311"] exclude = ''' /( migrations @@ -62,5 +62,5 @@ exclude = ''' ''' [build-system] -requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/website/orders/migrations/0009_order_picked_up_order_picked_up_at.py b/website/orders/migrations/0003_order_picked_up_order_picked_up_at.py similarity index 83% rename from website/orders/migrations/0009_order_picked_up_order_picked_up_at.py rename to website/orders/migrations/0003_order_picked_up_order_picked_up_at.py index 775996ea..6a5eb9a5 100644 --- a/website/orders/migrations/0009_order_picked_up_order_picked_up_at.py +++ b/website/orders/migrations/0003_order_picked_up_order_picked_up_at.py @@ -1,11 +1,12 @@ -# Generated by Django 4.2.9 on 2024-03-10 09:10 +# Generated by Django 5.0.4 on 2024-04-28 19:53 from django.db import migrations, models class Migration(migrations.Migration): + dependencies = [ - ("orders", "0008_order_priority"), + ("orders", "0002_initial"), ] operations = [ diff --git a/website/orders/urls.py b/website/orders/urls.py index 66f261cb..fbb6ca6d 100644 --- a/website/orders/urls.py +++ b/website/orders/urls.py @@ -12,5 +12,4 @@ path("/admin/", views.ShiftManagementView.as_view(), name="shift_admin"), path("/overview/", views.ShiftView.as_view(), name="shift_overview"), path("/join/", views.JoinShiftView.as_view(), name="shift_join"), - path("/status/", views.StatusScreen.as_view(), name="status"), ] diff --git a/website/orders/views.py b/website/orders/views.py index 53f8e7c7..41680424 100644 --- a/website/orders/views.py +++ b/website/orders/views.py @@ -145,17 +145,6 @@ def post(self, request, **kwargs): return render(request, self.template_name, {"shift": shift}) -class StatusScreen(TemplateView): - """Status screen for a Shift.""" - - template_name = "orders/status_screen.html" - - def get(self, request, **kwargs): - """GET request for status screen view.""" - shift = kwargs.get("shift") - return render(request, self.template_name, {"shift": shift}) - - class AccountHistoryTabView(LoginRequiredMixin, TemplateView): """Account order history view.""" diff --git a/website/status_screen/__init__.py b/website/status_screen/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/website/status_screen/apps.py b/website/status_screen/apps.py new file mode 100644 index 00000000..dad9fa38 --- /dev/null +++ b/website/status_screen/apps.py @@ -0,0 +1,8 @@ +from django.apps import AppConfig + + +class StatusScreenConfig(AppConfig): + """Status Screen App Config.""" + + default_auto_field = "django.db.models.BigAutoField" + name = "status_screen" diff --git a/website/status_screen/migrations/__init__.py b/website/status_screen/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/website/orders/static/orders/css/status-screen.css b/website/status_screen/static/status_screen/css/status-screen.css similarity index 100% rename from website/orders/static/orders/css/status-screen.css rename to website/status_screen/static/status_screen/css/status-screen.css diff --git a/website/orders/templates/orders/status_screen.html b/website/status_screen/templates/status_screen/status_screen.html similarity index 98% rename from website/orders/templates/orders/status_screen.html rename to website/status_screen/templates/status_screen/status_screen.html index 9eb9fbe2..fcf28ee1 100644 --- a/website/orders/templates/orders/status_screen.html +++ b/website/status_screen/templates/status_screen/status_screen.html @@ -2,7 +2,7 @@ {% load static %} {% block styles %} - + {% endblock %} {% block header %} diff --git a/website/status_screen/urls.py b/website/status_screen/urls.py new file mode 100644 index 00000000..96833e73 --- /dev/null +++ b/website/status_screen/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from status_screen import views + +urlpatterns = [ + path("/", views.StatusScreen.as_view(), name="status"), +] diff --git a/website/status_screen/views.py b/website/status_screen/views.py new file mode 100644 index 00000000..a6278a2f --- /dev/null +++ b/website/status_screen/views.py @@ -0,0 +1,13 @@ +from django.shortcuts import render +from django.views.generic import TemplateView + + +class StatusScreen(TemplateView): + """Status screen for a Shift.""" + + template_name = "status_screen/status_screen.html" + + def get(self, request, **kwargs): + """GET request for status screen view.""" + shift = kwargs.get("shift") + return render(request, self.template_name, {"shift": shift}) diff --git a/website/tosti/settings/base.py b/website/tosti/settings/base.py index 547dc47e..46b28b3d 100644 --- a/website/tosti/settings/base.py +++ b/website/tosti/settings/base.py @@ -37,6 +37,7 @@ "transactions", "orders", "silvasoft", + "status_screen", "oauth2_provider", "corsheaders", "yivi", @@ -195,7 +196,8 @@ ), "VENUES_SEND_RESERVATION_REQUEST_EMAILS_TO": ( "noreply@example.com, noreply@example.com", - "Where to send venue reservation request notifications to (e-mail address), enter multiple addresses by using a comma (,)", + "Where to send venue reservation request notifications to (e-mail address), enter multiple addresses by using " + "a comma (,)", str, ), "SHIFTS_DEFAULT_MAX_ORDERS_TOTAL": (70, "Default maximum number of orders per shift", int), @@ -282,4 +284,4 @@ AGE_VERIFICATION_INSTITUTE_VALUE = "ru.nl" YIVI_SERVER_URL = os.environ.get("YIVI_SERVER_URL") -YIVI_SERVER_TOKEN = os.environ.get("YIVI_SERVER_TOKEN") \ No newline at end of file +YIVI_SERVER_TOKEN = os.environ.get("YIVI_SERVER_TOKEN") diff --git a/website/tosti/urls.py b/website/tosti/urls.py index 5514de71..24c18fe7 100644 --- a/website/tosti/urls.py +++ b/website/tosti/urls.py @@ -50,6 +50,10 @@ "fridges/", include(("fridges.urls", "fridges"), namespace="fridges"), ), + path( + "status/", + include(("status_screen.urls", "status_screen"), namespace="status_screen"), + ), path("api/", include("tosti.api.urls")), path("saml/", include("djangosaml2.urls")), path(