initial shift overview and shift admin view
parent
85d05299c6
commit
bb81f69cb3
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>{% block title %}Help!{% endblock %}</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="content">
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,11 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Freie Schichten{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<h2>Freie Scchichten:</h2>
|
||||||
|
<ul>
|
||||||
|
{% for shift in free_shifts %}
|
||||||
|
<li>{{ shift.room.name }} {{shift.start_at}}<a href="todo reg url">Mithelfen</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
@ -1,4 +1,12 @@
|
|||||||
from django.http import HttpResponse
|
from django.shortcuts import render
|
||||||
|
from .models import Shift
|
||||||
|
import datetime
|
||||||
|
from django.db.models import F, Count
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
return HttpResponse('Hello, world!')
|
# dont show shifts starting in <60 minutes?
|
||||||
|
# currently only sorts by date
|
||||||
|
free_shifts = Shift.objects.annotate(reg_count=Count('shiftregistration')).filter(start_at__gt=datetime.datetime.now(),
|
||||||
|
room__required_helpers__gt=F('reg_count')).order_by('start_at')
|
||||||
|
context = {'free_shifts': free_shifts}
|
||||||
|
return render(request, 'shiftlist.html', context)
|
||||||
|
Loading…
Reference in New Issue