add team per room view, sort overview rooms

pull/1/head
parent 012cc6be1b
commit 84e944ae67

@ -3,7 +3,9 @@
{% block title %}Schichtdetails{% endblock %}
{% block content %}
<h3 class="title is-spaced">{% if shift.deleted %}(gelöscht) {% endif %}{{ shift.room.name }} {{ shift.start_at }} ({{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }})</h3>
<h3 class="title is-spaced">{% if shift.deleted %}(gelöscht) {% endif %}
<a href="{% url 'team:shift_room' shift.room.name %}">{{ shift.room.name }}</a>
{{ shift.start_at }} ({{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }})</h3>
{% if shift.room.description %}
<div class="description">
<strong>Beschreibung:</strong>

@ -16,7 +16,7 @@
<div class="columns is-multiline">
{% for shift in next_shifts %}
<div class="column is-one-quarter">
<h5 class="subtitle">{{ shift.room.name }}</h5>
<h5 class="subtitle"><a href="{% url 'team:shift_room' shift.room.name %}">{{ shift.room.name }}</a></h5>
<a class="" href="{% url 'team:shift' shift.id %}">
{% include "partials/shift_box.html" %}
</a>

@ -7,6 +7,7 @@ urlpatterns = [
path("", views.shift_overview, name="index"),
path("overview/", views.shift_overview, name="shift_overview"),
path("shifts/", views.ShiftList.as_view(), name="shift_all"),
path("room_shifts/<path:pk>", views.RoomShiftList.as_view(), name="shift_room"),
path("free_shifts/", views.FreeShiftList.as_view(), name="shift_free"),
path("shift/<int:pk>", views.shift_detail, name="shift"),
path("helper/<int:pk>", views.HelperDetail.as_view(), name="helper"),

@ -40,7 +40,7 @@ def shift_overview(request):
Shift.objects.filter(room=room, start_at__gt=timezone.now(), deleted=False)
.order_by("start_at")
.first()
for room in Room.objects.all()
for room in Room.objects.all().order_by("name")
),
)
@ -187,7 +187,7 @@ class ShiftList(LoginRequiredMixin, ListView):
return context
def get_ordering(self):
return ("start_at", "room_id")
return ("start_at", "room__name")
class FreeShiftList(ShiftList):
@ -210,7 +210,29 @@ class FreeShiftList(ShiftList):
end_at__gte=timezone.now(),
deleted=False,
)
.order_by("start_at", "room_id")
.order_by("start_at", "room__name")
)
class RoomShiftList(ShiftList):
def get_context_data(self, **kwargs):
room = get_object_or_404(Room, pk=self.kwargs["pk"])
context = super().get_context_data(**kwargs)
context["title"] = f"Schichten fuer {room.name}"
return context
def get_queryset(self):
room = get_object_or_404(Room, pk=self.kwargs["pk"])
help_wanted = Q(required_helpers__gt=F("reg_count")) | Q(
required_helpers=0
) & Q(room__required_helpers__gt=F("reg_count"))
return (
Shift.with_reg_count()
.filter(
deleted=False,
room=room,
)
.order_by("start_at", "room__name")
)

Loading…
Cancel
Save