implement my_fallback_shifts view
parent
f5690bc866
commit
332fb0b4cd
@ -0,0 +1,37 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block head %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h2 class="title">Fallback-Schichten für {{ team_member.name }}</h2>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Wann</th>
|
||||
<th>Wo</th>
|
||||
<th>Helfer:innen</th>
|
||||
<th>Team-Mitglieder</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for shift in shifts %}
|
||||
<tr {% if shift.registration_count == shift.required_helpers|default:shift.room.required_helpers %}style="opacity: 0.2"{% endif %}>
|
||||
<td>{{ shift.start_at }}</td>
|
||||
<td>{{ shift.room.name }} </td>
|
||||
<td>{{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}</td>
|
||||
<td>
|
||||
{% for assignment in shift.fallbackassignment_set.all %}
|
||||
{{ assignment.team_member.name }}{% if not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
@ -0,0 +1,11 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path(
|
||||
"fallback_shifts/<int:team_member_id>",
|
||||
views.my_fallback_shifts,
|
||||
name="my_fallback_shifts",
|
||||
),
|
||||
]
|
@ -1,3 +1,14 @@
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
|
||||
from shiftregister.fallback.models import TeamMember
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def my_fallback_shifts(request, team_member_id):
|
||||
team_member = get_object_or_404(TeamMember, pk=team_member_id)
|
||||
context = {"team_member": team_member, "shifts": team_member.fallback_shifts.all()}
|
||||
|
||||
print(context)
|
||||
|
||||
return render(request, "my_fallback_shifts.html", context)
|
||||
|
Loading…
Reference in New Issue