Skip to content

Commit

Permalink
Move status screen to its own app
Browse files Browse the repository at this point in the history
  • Loading branch information
KiOui committed Apr 28, 2024
1 parent 9891f97 commit 566d3ac
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 20 deletions.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sentry-sdk = "^1.14.0"

[tool.black]
line-length = 119
target-version = ["py310"]
target-version = ["py311"]
exclude = '''
/(
migrations
Expand All @@ -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"
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
1 change: 0 additions & 1 deletion website/orders/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
path("<shift:shift>/admin/", views.ShiftManagementView.as_view(), name="shift_admin"),
path("<shift:shift>/overview/", views.ShiftView.as_view(), name="shift_overview"),
path("<shift:shift>/join/", views.JoinShiftView.as_view(), name="shift_join"),
path("<shift:shift>/status/", views.StatusScreen.as_view(), name="status"),
]
11 changes: 0 additions & 11 deletions website/orders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down
Empty file.
8 changes: 8 additions & 0 deletions website/status_screen/apps.py
Original file line number Diff line number Diff line change
@@ -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"
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load static %}

{% block styles %}
<link rel="stylesheet" href="{% static 'orders/css/status-screen.css' %}"/>
<link rel="stylesheet" href="{% static 'status_screen/css/status-screen.css' %}"/>
{% endblock %}

{% block header %}
Expand Down
7 changes: 7 additions & 0 deletions website/status_screen/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.urls import path

from status_screen import views

urlpatterns = [
path("<shift:shift>/", views.StatusScreen.as_view(), name="status"),
]
13 changes: 13 additions & 0 deletions website/status_screen/views.py
Original file line number Diff line number Diff line change
@@ -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})
6 changes: 4 additions & 2 deletions website/tosti/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"transactions",
"orders",
"silvasoft",
"status_screen",
"oauth2_provider",
"corsheaders",
"yivi",
Expand Down Expand Up @@ -195,7 +196,8 @@
),
"VENUES_SEND_RESERVATION_REQUEST_EMAILS_TO": (
"[email protected], [email protected]",
"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),
Expand Down Expand Up @@ -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")
YIVI_SERVER_TOKEN = os.environ.get("YIVI_SERVER_TOKEN")
4 changes: 4 additions & 0 deletions website/tosti/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 566d3ac

Please sign in to comment.