diff --git a/collector/templates/collector/base.html b/collector/templates/collector/base.html
deleted file mode 100644
index da95fa5..0000000
--- a/collector/templates/collector/base.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
- Teilchensammler
-
-
-
- {% block content %}
-
- {% endblock content %}
-
-
diff --git a/collector/templates/collector/detail.html b/collector/templates/collector/detail.html
index d78c2f0..898dd8f 100644
--- a/collector/templates/collector/detail.html
+++ b/collector/templates/collector/detail.html
@@ -1,20 +1,2 @@
-{% extends "collector/base.html" %}
-
-{% block content %}
-
[{{ teil.id }}] {{ teil.name }}
-Last Changed: {{ teil.modified | date:"Y-m-d H:i:s e" }}
-
-
-See the {{ default_teile_number }} most recent Teile.
-
-
-
-See ALL the Teile in the database.
-
-
-
-home
-
-
-{% endblock content %}
+Last Changed: {{ teil.modified }}
diff --git a/collector/templates/collector/index.html b/collector/templates/collector/index.html
index ec294a8..4611dff 100644
--- a/collector/templates/collector/index.html
+++ b/collector/templates/collector/index.html
@@ -1,7 +1,3 @@
-{% extends "collector/base.html" %}
-
-{% block content %}
-
{% if teile_list %}
{% else %}
- Noch keine Teile da.
+ Keine Teile da.
{% endif %}
@@ -25,13 +21,3 @@
-
-
-See ALL the Teile in the dabase.
-
-
-
-home
-
-
-{% endblock content %}
diff --git a/collector/urls.py b/collector/urls.py
index 4b1c7bb..d12fc75 100644
--- a/collector/urls.py
+++ b/collector/urls.py
@@ -5,8 +5,8 @@ from . import views
app_name = "collector"
urlpatterns = [
- path("", views.IndexView.as_view(), name="list"),
+ path("", views.IndexView.as_view(), name="index"),
path("recorded//", views.DetailView.as_view(), name="detail"),
path("enter/", views.enter, name="enter"),
- path("all/", views.TeileListView.as_view(), name="list-all"),
+ path("all/", views.ListView.as_view(), name="all"),
]
diff --git a/collector/views.py b/collector/views.py
index cc6023d..b77979a 100644
--- a/collector/views.py
+++ b/collector/views.py
@@ -1,5 +1,4 @@
import logging
-from typing import Any
from django.db import transaction
from django.db.models import QuerySet
@@ -12,23 +11,15 @@ from .models import Teil
logger = logging.getLogger(__name__)
-DEFAULT_TEILE_NUMBER = 10
-
-class TeileListView(generic.ListView):
+class ListView(generic.ListView):
template_name = "collector/index.html"
context_object_name = "teile_list"
def get_queryset(self) -> QuerySet:
return Teil.objects.order_by("-modified")
- def get_context_data(self, **kwargs) -> dict[str, Any]:
- context = super().get_context_data(**kwargs)
- context["default_teile_number"] = DEFAULT_TEILE_NUMBER
- return context
-
-
-class IndexView(TeileListView):
+class IndexView(ListView):
def get_queryset(self) -> QuerySet:
return super().get_queryset()[:10]
@@ -37,12 +28,6 @@ class DetailView(generic.DetailView):
model = Teil
template_name = "collector/detail.html"
- def get_context_data(self, **kwargs) -> dict[str, Any]:
- context = super().get_context_data(**kwargs)
- context["default_teile_number"] = DEFAULT_TEILE_NUMBER
-
- return context
-
def enter(request: HttpRequest) -> HttpResponse:
try:
@@ -51,4 +36,4 @@ def enter(request: HttpRequest) -> HttpResponse:
except Exception:
logger.warning("Teil already existed")
- return HttpResponseRedirect(reverse("collector:list"))
+ return HttpResponseRedirect(reverse("collector:index"))
diff --git a/justfile b/justfile
index 7ae5614..228b22f 100644
--- a/justfile
+++ b/justfile
@@ -13,7 +13,7 @@ lint-django:
python -m django check
lint-woodpecker:
- -woodpecker-cli lint .woodpecker/workflow.yaml
+ woodpecker-cli lint .woodpecker/workflow.yaml
serve:
python -m django runserver