Compare commits
No commits in common. "a073a9f90ba16954cc59a113fa768be43f099571" and "517aaa1ff4fcff4497cd8f4251e7085ee224f3ef" have entirely different histories.
a073a9f90b
...
517aaa1ff4
|
@ -19,13 +19,14 @@
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block footer_content %}
|
{% block footer %}
|
||||||
|
<div class="content">
|
||||||
{% if DEBUG %}
|
{% if DEBUG %}
|
||||||
<br>
|
|
||||||
(Debug-Modus)
|
(Debug-Modus)
|
||||||
{% if helper %}
|
{% if helper %}
|
||||||
<a href="{% url 'token_logout' %}">logout</a>
|
<a href="{% url 'token_logout' %}">logout</a>
|
||||||
<a href="{{ helper.logintoken_set.first.get_absolute_url }}">login url</a>
|
<a href="{{ helper.logintoken_set.first.get_absolute_url }}">login url</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
src: url("{% static 'MavenPro-VariableFont:wght.ttf' %}");
|
src: url("{% static 'MavenPro-VariableFont:wght.ttf' %}");
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover > .box {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: "Maven Pro", sans-serif !important;
|
font-family: "Maven Pro", sans-serif !important;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
@ -27,10 +23,6 @@
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
button, input, select, textarea {
|
|
||||||
font-family: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--background: #fff;
|
--background: #fff;
|
||||||
}
|
}
|
||||||
|
@ -72,10 +64,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
a:hover > .box {
|
|
||||||
background: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--background: #17181c;
|
--background: #17181c;
|
||||||
}
|
}
|
||||||
|
@ -117,11 +105,9 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container is-flex is-flex-wrap-wrap is-justify-content-space-between">
|
<div class="container is-flex is-flex-wrap-wrap is-justify-content-space-between">
|
||||||
<div class="content">
|
{% block footer %}
|
||||||
<a href="https://git.as42.net/kontakt/shiftregister">shiftregister</a> by flo, Luca & xAndy
|
<div class="content"><a href="https://git.as42.net/kontakt/shiftregister">shiftregister</a> by flo, Luca & xAndy</div>
|
||||||
{% block footer_content %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
|
||||||
<div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5">
|
<div class="breadcrumb has-dot-separator is-flex-grow-1 is-right ml-5">
|
||||||
<ul>
|
<ul>
|
||||||
{% for item in footer_nav_items %}
|
{% for item in footer_nav_items %}
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
{% if is_paginated %}
|
{% if page.has_other_pages %}
|
||||||
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
|
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
|
||||||
{% if page_obj.has_previous %}
|
{% if page.has_previous %}
|
||||||
<a class="pagination-previous" href="?page={{ page_obj.previous_page_number }}"><</a>
|
<a class="pagination-previous" href="?page={{ page.previous_page_number }}"><</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="pagination-previous is-disabled"><</a>
|
<a class="pagination-previous is-disabled"><</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page_obj.has_next %}
|
{% if page.has_next %}
|
||||||
<a class="pagination-next" href="?page={{ page_obj.next_page_number }}">></a>
|
<a class="pagination-next" href="?page={{ page.next_page_number }}">></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="pagination-next is-disabled">></a>
|
<a class="pagination-next is-disabled">></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<ul class="pagination-list">
|
<ul class="pagination-list">
|
||||||
{% for p in page_range %}
|
{% for p in page_range %}
|
||||||
<li>
|
<li>
|
||||||
{% if p == paginator.ELLIPSIS %}
|
{% if p == page.paginator.ELLIPSIS %}
|
||||||
<span class="pagination-ellipsis">{{ paginator.ELLIPSIS }}</span>
|
<span class="pagination-ellipsis">{{ page.paginator.ELLIPSIS }}</span>
|
||||||
{% elif p == page_obj.number %}
|
{% elif p == page.number %}
|
||||||
<span class="pagination-link is-current">{{ p }}</span>
|
<a class="pagination-link is-current">{{ p }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="pagination-link" href="?page={{ p }}">{{ p }}</a>
|
<a class="pagination-link" href="?page={{ p }}">{{ p }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3 class="title">{{ title }}</h3>
|
<h3 class="title">{{ title }}</h3>
|
||||||
<table class="table is-fullwidth">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for reg in page_obj %}
|
{% for reg in object_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url 'team:helper' reg.helper.pk %}">
|
<a href="{% url 'team:helper' reg.helper.pk %}">
|
||||||
|
@ -27,26 +27,19 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a{% if reg.shift.event.calendar.needs_fallback %} class="is-underlined"{% endif %} href="{% url 'team:shift_room' reg.shift.room.pk %}">{{ reg.shift.room }}</a>
|
<span class="{{ reg.shift.event.calendar.needs_fallback|yesno:"is-underlined," }}">
|
||||||
|
<a href="{% url 'team:shift_room' reg.shift.room.pk %}">{{ reg.shift.room }}</a>
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td><a href="{% url 'team:shift' reg.shift.pk %}">{{ reg.shift.start_at }}</a></td>
|
<td><a href="{% url 'team:shift' reg.shift.pk %}">{{ reg.shift.start_at }}</a></td>
|
||||||
<td><a href="{% url 'team:shift' reg.shift.pk %}">{{ reg.shift.duration|duration }}</a></td>
|
<td><a href="{% url 'team:shift' reg.shift.pk %}">{{ reg.shift.duration|duration }}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="buttons">
|
<a class="button is-success is-small" href="{% url 'team:checkin' reg.pk %}">Als angekommen markieren</a>
|
||||||
<form action="{% url 'team:checkin' reg.pk %}" method="post">
|
<a class="button is-danger is-small" href="{% url 'team:mark_as_failed' reg.pk %}">Nicht angetreten</a>
|
||||||
{% csrf_token %}
|
|
||||||
<button class="button is-success is-small mr-2" type="submit">Als angekommen markieren</button>
|
|
||||||
</form>
|
|
||||||
<form action="{% url 'team:mark_as_failed' reg.pk %}" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<button class="button is-danger is-small mr-2" type="submit">Nicht angetreten</button>
|
|
||||||
</form>
|
|
||||||
<a class="button is-link is-small" href="tel:{{ reg.helper.phone }}">📞</a>
|
<a class="button is-link is-small" href="tel:{{ reg.helper.phone }}">📞</a>
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% include "pagination.html" %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block title %}{{ action|default:"Aktion bestätigen" }}{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<h3 class="title">{{ action|default:"Aktion bestätigen" }}</h3>
|
|
||||||
<form method="POST">
|
|
||||||
{% csrf_token %}
|
|
||||||
<button class="button is-{{ button_style|default:"danger" }} is-small" type="submit">{{ button_text|default:"Bestätigen" }}</button>
|
|
||||||
</form>
|
|
||||||
<a class="button mt-3" href="{% url 'team:shift' reg.shift.pk %}">Zurück</a>
|
|
||||||
{% endblock %}
|
|
|
@ -13,7 +13,9 @@
|
||||||
<h5 class="subtitle">Schichten</h5>
|
<h5 class="subtitle">Schichten</h5>
|
||||||
<div class="columns is-multiline">
|
<div class="columns is-multiline">
|
||||||
{% for reg in helper.shiftregistration_set.all %}
|
{% for reg in helper.shiftregistration_set.all %}
|
||||||
|
<a class="" href="{% url 'team:shift' reg.shift.id %}">
|
||||||
{% include 'partials/shift_list_item.html' with shift=reg.shift %}
|
{% include 'partials/shift_list_item.html' with shift=reg.shift %}
|
||||||
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<h5 class="subtitle" id="history">Nachrichtenverlauf</h5>
|
<h5 class="subtitle" id="history">Nachrichtenverlauf</h5>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h3 class="title">Eingehende Nachrichten</h3>
|
<h3 class="title">Eingehende Nachrichten</h3>
|
||||||
{% for message in page_obj %}
|
{% for message in page %}
|
||||||
<a href="{% if message.from_helper %}{% url 'team:helper' message.from_helper.pk %}#history{% else %}{% url 'team:incoming_message' message.pk %}{% endif %}">
|
<a href="{% if message.from_helper %}{% url 'team:helper' message.from_helper.pk %}#history{% else %}{% url 'team:incoming_message' message.pk %}{% endif %}">
|
||||||
<div class="message{% if not message.read %} is-info{% endif %} mb-5">
|
<div class="message{% if not message.read %} is-info{% endif %} mb-5">
|
||||||
<div class="message-header">
|
<div class="message-header">
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Helfer*in wirklich sperren?{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h3 class="title">Helfer*in wirklich sperren?</h3>
|
||||||
|
<form method="POST">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="button is-danger is-small" type="submit">Schicht als "nicht angetreten" markieren und Helfer*in sperren</button>
|
||||||
|
</form>
|
||||||
|
<a class="button mt-3" href="{% url 'team:shift' reg.shift.pk %}">Zurück</a>
|
||||||
|
{% endblock %}
|
|
@ -1,5 +1,4 @@
|
||||||
<a href="{% url 'team:shift' shift.pk %}">
|
<div class="box">
|
||||||
<div class="box">
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{% if shift.deleted %}
|
{% if shift.deleted %}
|
||||||
<em>gelöscht</em><br>
|
<em>gelöscht</em><br>
|
||||||
|
@ -13,5 +12,7 @@
|
||||||
<strong>Checkin-Status:</strong> {% if shift.checkin_count >= shift.required_helpers|default:shift.room.required_helpers %}<span class="tag is-rounded is-success">vollständig</span>{% elif shift.checkin_count > 0 %}<span class="tag is-rounded is-warning">teilweise</span>{% else %}<span class="tag is-rounded is-danger">kein Checkin</span>{% endif %}
|
<strong>Checkin-Status:</strong> {% if shift.checkin_count >= shift.required_helpers|default:shift.room.required_helpers %}<span class="tag is-rounded is-success">vollständig</span>{% elif shift.checkin_count > 0 %}<span class="tag is-rounded is-warning">teilweise</span>{% else %}<span class="tag is-rounded is-danger">kein Checkin</span>{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="buttons is-right mt-3">
|
||||||
|
<a class="button is-info is-small mr-0" href="{% url 'team:shift' shift.id %}">Details</a>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</div>
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block title %}{{ room.name }}{% endblock %}
|
|
||||||
|
|
||||||
{% block everything %}
|
{% block everything %}
|
||||||
<section class="section">
|
<section class="section">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h3 class="title" style="background:var(--background);margin:0 -1rem;padding:1rem;position:sticky;top:0;">Helfer*innen für {{ room.name }}</h3>
|
<h3 class="title" style="background:var(--background);margin:0 -1rem;padding:1rem;position:sticky;top:0;">Helfer:innen für {{ room.name }}</h3>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead style="background:inherit;position:sticky;top:4rem;">
|
<thead style="background:inherit;position:sticky;top:4rem;">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Startzeit</th>
|
<th>Startzeit</th>
|
||||||
<th>Helfer*innen</th>
|
<th>Helfer:innen</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for shift in shifts %}
|
{% for shift in room.valid_shifts.all|dictsort:"start_at" %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ shift.start_at }}</td>
|
<td>{{ shift.start_at }}</td>
|
||||||
<td>{% for reg in shift.valid_registrations.all %}{{ reg.helper.name }}{% if not forloop.last %}, {% endif %}{% endfor %}</td>
|
<td>{% for reg in shift.valid_registrations.all %}{{ reg.helper.name }}{% if not forloop.last %}, {% endif %}{% endfor %}</td>
|
||||||
|
|
|
@ -32,18 +32,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
{% if reg.is_pending %}
|
{% if reg.is_pending %}
|
||||||
<form action="{% url 'team:checkin' reg.pk %}" method="post">
|
<a class="button is-success is-small" href="{% url 'team:checkin' reg.pk %}">Als angekommen markieren</a>
|
||||||
{% csrf_token %}
|
<a class="button is-warning is-small" href="{% url 'team:unregister' reg.pk %}">Helfer*in abmelden</a>
|
||||||
<button class="button is-success is-small mr-2" type="submit">Als angekommen markieren</button>
|
<a class="button is-danger is-small" href="{% url 'team:mark_as_failed' reg.pk %}">Nicht angetreten</a>
|
||||||
</form>
|
|
||||||
<form action="{% url 'team:unregister' reg.pk %}" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<button class="button is-warning is-small mr-2" type="submit">Helfer*in abmelden</button>
|
|
||||||
</form>
|
|
||||||
<form action="{% url 'team:mark_as_failed' reg.pk %}" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<button class="button is-danger is-small" type="submit">Nicht angetreten</button>
|
|
||||||
</form>
|
|
||||||
{% elif reg.is_checked_in %}
|
{% elif reg.is_checked_in %}
|
||||||
<button class="button is-success is-small" style="pointer-events:none;">✓</button>
|
<button class="button is-success is-small" style="pointer-events:none;">✓</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
<h3 class="title">{{ title }}</h3>
|
<h3 class="title">{{ title }}</h3>
|
||||||
<div class="columns is-multiline">
|
<div class="columns is-multiline">
|
||||||
{% for shift in object_list %}
|
{% for shift in object_list %}
|
||||||
|
<a class="" href="{% url 'team:shift' shift.id %}">
|
||||||
{% include "partials/shift_list_item.html" %}
|
{% include "partials/shift_list_item.html" %}
|
||||||
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -25,7 +25,9 @@
|
||||||
{% for shift in next_shifts_per_room %}
|
{% for shift in next_shifts_per_room %}
|
||||||
<div class="column is-one-quarter">
|
<div class="column is-one-quarter">
|
||||||
<h5 class="subtitle"><a href="{% url 'team:shift_room' shift.room.name %}">{{ shift.room.name }}</a></h5>
|
<h5 class="subtitle"><a href="{% url 'team:shift_room' shift.room.name %}">{{ shift.room.name }}</a></h5>
|
||||||
|
<a href="{% url 'team:shift' shift.id %}">
|
||||||
{% include "partials/shift_box.html" %}
|
{% include "partials/shift_box.html" %}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,7 +16,7 @@ urlpatterns = [
|
||||||
path("checkin/<int:pk>", views.checkin, name="checkin"),
|
path("checkin/<int:pk>", views.checkin, name="checkin"),
|
||||||
path("mark_as_failed/<int:pk>", views.mark_as_failed, name="mark_as_failed"),
|
path("mark_as_failed/<int:pk>", views.mark_as_failed, name="mark_as_failed"),
|
||||||
path("remove_helper/<int:pk>", views.delete_shiftregistration, name="unregister"),
|
path("remove_helper/<int:pk>", views.delete_shiftregistration, name="unregister"),
|
||||||
path("incoming/", views.IncomingMessagesList.as_view(), name="incoming_messages"),
|
path("incoming/", views.incoming_messages, name="incoming_messages"),
|
||||||
path("incoming/<slug:pk>", views.incoming_message, name="incoming_message"),
|
path("incoming/<slug:pk>", views.incoming_message, name="incoming_message"),
|
||||||
path("incoming/mark_as_read/<slug:pk>", views.mark_as_read, name="mark_as_read"),
|
path("incoming/mark_as_read/<slug:pk>", views.mark_as_read, name="mark_as_read"),
|
||||||
path("list/<slug:token>", views.room_view_token, name="room_view_token"),
|
path("list/<slug:token>", views.room_view_token, name="room_view_token"),
|
||||||
|
|
|
@ -284,43 +284,32 @@ class RoomShiftList(ShiftList):
|
||||||
|
|
||||||
|
|
||||||
class CheckinList(LoginRequiredMixin, ListView):
|
class CheckinList(LoginRequiredMixin, ListView):
|
||||||
paginate_by = 30
|
|
||||||
template_name = "checkin_list.html"
|
template_name = "checkin_list.html"
|
||||||
title = "Ankommende Helfer*innen"
|
model = Shift
|
||||||
|
title = "Ankommende Helfer:innen"
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return (
|
return ShiftRegistration.objects.filter(
|
||||||
ShiftRegistration.objects.select_related("helper", "shift")
|
shift__deleted=False,
|
||||||
.prefetch_related("shift__event__calendar")
|
state=ShiftRegistration.RegState.REGISTERED,
|
||||||
.filter(shift__deleted=False, state=ShiftRegistration.RegState.REGISTERED)
|
).order_by("shift__start_at")[:30]
|
||||||
.order_by("shift__start_at", "shift__room__name")
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["page_range"] = context["paginator"].get_elided_page_range(
|
|
||||||
context["page_obj"].number
|
|
||||||
)
|
|
||||||
context["title"] = self.title
|
context["title"] = self.title
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
def get_ordering(self):
|
||||||
|
return ("start_at", "room__name")
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def checkin(request, pk):
|
def checkin(request, pk):
|
||||||
reg = get_object_or_404(ShiftRegistration, pk=pk)
|
reg = get_object_or_404(ShiftRegistration, pk=pk)
|
||||||
|
|
||||||
if request.method == "POST":
|
|
||||||
reg.state = reg.RegState.CHECKED_IN
|
reg.state = reg.RegState.CHECKED_IN
|
||||||
reg.save()
|
reg.save()
|
||||||
|
|
||||||
return redirect("team:shift", pk=reg.shift.pk)
|
return redirect("team:shift", pk=reg.shift.pk)
|
||||||
|
|
||||||
return render(
|
|
||||||
request,
|
|
||||||
"csrf_protect.html",
|
|
||||||
{"action": "Als angekommen markieren", "button_text": "Angekommen", "reg": reg},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def mark_as_failed(request, pk):
|
def mark_as_failed(request, pk):
|
||||||
|
@ -335,50 +324,33 @@ def mark_as_failed(request, pk):
|
||||||
|
|
||||||
return redirect("team:shift", pk=reg.shift.pk)
|
return redirect("team:shift", pk=reg.shift.pk)
|
||||||
|
|
||||||
return render(
|
return render(request, "molly_guard.html", {"reg": reg})
|
||||||
request,
|
|
||||||
"csrf_protect.html",
|
|
||||||
{
|
|
||||||
"action": 'Schicht als "nicht angetreten" markieren',
|
|
||||||
"button_text": "Nicht angetreten",
|
|
||||||
"reg": reg,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def delete_shiftregistration(request, pk):
|
def delete_shiftregistration(request, pk):
|
||||||
reg = get_object_or_404(ShiftRegistration, pk=pk)
|
reg = get_object_or_404(ShiftRegistration, pk=pk)
|
||||||
|
spk = reg.shift.pk
|
||||||
if request.method == "POST":
|
|
||||||
reg.delete()
|
reg.delete()
|
||||||
|
return redirect("team:shift", pk=spk)
|
||||||
|
|
||||||
return redirect("team:shift", pk=reg.shift.pk)
|
|
||||||
|
@login_required
|
||||||
|
def incoming_messages(request):
|
||||||
|
p = Paginator(IncomingMessage.objects.order_by("read", "-created_at"), 10)
|
||||||
|
page = p.get_page(request.GET.get("page"))
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"csrf_protect.html",
|
"incoming_messages.html",
|
||||||
{"action": "Helfer*in abmelden", "button_text": "Abmelden", "reg": reg},
|
{
|
||||||
|
"num_unread": IncomingMessage.objects.filter(read=False).count(),
|
||||||
|
"page": page,
|
||||||
|
"page_range": p.get_elided_page_range(page.number),
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class IncomingMessagesList(LoginRequiredMixin, ListView):
|
|
||||||
model = IncomingMessage
|
|
||||||
paginate_by = 10
|
|
||||||
template_name = "incoming_messages.html"
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
context = super().get_context_data(**kwargs)
|
|
||||||
context["num_unread"] = IncomingMessage.objects.filter(read=False).count()
|
|
||||||
context["page_range"] = context["paginator"].get_elided_page_range(
|
|
||||||
context["page_obj"].number
|
|
||||||
)
|
|
||||||
return context
|
|
||||||
|
|
||||||
def get_ordering(self):
|
|
||||||
return ("read", "-created_at")
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def incoming_message(request, pk):
|
def incoming_message(request, pk):
|
||||||
message = get_object_or_404(IncomingMessage, pk=pk)
|
message = get_object_or_404(IncomingMessage, pk=pk)
|
||||||
|
@ -401,11 +373,10 @@ def mark_as_read(request, pk):
|
||||||
|
|
||||||
|
|
||||||
def room_view_token(request, token):
|
def room_view_token(request, token):
|
||||||
token = get_object_or_404(RoomViewToken, pk=token)
|
|
||||||
room = token.room
|
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"room_registrations.html",
|
"room_registrations.html",
|
||||||
{"room": room, "shifts": room.valid_shifts().order_by("start_at")},
|
{
|
||||||
|
"room": get_object_or_404(RoomViewToken, pk=token).room,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue