implement my_fallback_shifts view
This commit is contained in:
parent
f5690bc866
commit
332fb0b4cd
|
@ -4,14 +4,13 @@ from django.db import migrations
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('fallback', '0003_fallbackassignment_slot_teammember_fallback_shifts'),
|
||||
("fallback", "0003_fallbackassignment_slot_teammember_fallback_shifts"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='fallbackassignment',
|
||||
name='slot',
|
||||
model_name="fallbackassignment",
|
||||
name="slot",
|
||||
),
|
||||
]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -22,5 +22,6 @@ urlpatterns = [
|
|||
path("", include("shiftregister.pages.urls")),
|
||||
path("team/", include("shiftregister.team.urls")),
|
||||
path("team/", include("shiftregister.signage.urls")),
|
||||
path("team/", include("shiftregister.fallback.urls")),
|
||||
path("admin/", admin.site.urls),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue