button next cafe

This commit is contained in:
Tom Irgang 2023-05-29 17:11:17 +02:00
parent e85cee2265
commit b13934b439
4 changed files with 94 additions and 2 deletions

View file

@ -10,11 +10,14 @@
<p>
<a href="{% url 'cafe' %}" class="btn btn-primary">Repair-Cafés</a>
<a href="{% url 'guest' %}" class="btn btn-primary">Gäste</a>
<a href="{% url 'device_questions' %}" class="btn btn-primary">Rückfragen</a>
</p>
<hr class="mt-0 mb-4">
<h1 class="mt-2">Repair-Cafés</h1>
<a href="{% url 'create_cafe' %}" class="btn btn-primary">Neues Repair-Café anlegen</a>
// TODO: Button nächstes Repair-Café
<p>
<a href="{% url 'create_cafe' %}" class="btn btn-primary">Neues Repair-Café anlegen</a>
<a href="{% url 'edit_cafe' next_cafe.pk %}" class="btn btn-primary">Nächstes Repair-Café</a>
</p>
<hr class="mt-0 mb-4">
<h1 class="mt-2">Geräte</h1>
<table class="table">

View file

@ -0,0 +1,63 @@
{% extends "repapp/base.html" %}
{% load crispy_forms_tags %}
{% block title %}
- Rückfragen
{% endblock title %}
{% block page_title %}
Rückfragen
{% endblock page_title %}
{% block content %}
<p>
<a onclick="history.back()" class="btn btn-primary">Zurück</a>
</p>
<table class="table">
<thead>
<tr>
<th scope="col">Geräts</th>
<th scope="col">Hersteller</th>
<th scope="col">Gast</th>
<th scope="col">Organisator</th>
<th scope="col">Reparateur</th>
<th scope="col">gesendet</th>
<th scope="col">beantwortet</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for question in questions %}
<tr>
<td>{{ question.device.device }}</td>
<td>{{ question.device.manufacturer }}</td>
<td>{{ question.device.guest.name }}</td>
<td>{{ question.organisator.mail }}</td>
<td>{{ question.reparateur.mail }}</td>
<td>
{% if question.sent %}
Ja
{% else %}
Nein
{% endif %}
</td>
<td>
{% if question.answered %}
Ja
{% else %}
Nein
{% endif %}
</td>
<td>
<a href="{% url 'view_device_question' question.pk %}"
class="btn btn-primary">ansehen</a>
</td>
<td>
{% if not question.sent %}
<a href="{% url 'edit_device_question' question.pk %}"
class="btn btn-primary">senden</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}

View file

@ -39,6 +39,8 @@ urlpatterns = [
views.QuestionUpdateView.as_view(), name="edit_device_question"),
path("member/question/<int:question>/",
views.question, name="view_device_question"),
path("member/question/",
views.questions, name="device_questions"),
path("repa/", views.repa, name="repa"),
path("cafe/", views.CafeView.as_view(), name="cafe"),
path("cafe/create", views.CafeCreateView.as_view(), name="create_cafe"),

View file

@ -505,6 +505,9 @@ def orga(request):
questions_open_and_answered = Question.objects.filter(
open=True, answered=True).order_by('-date')
next_cafe = Cafe.objects.filter(
event_date__gte=datetime.datetime.today()).order_by('event_date').first()
return render(
request,
"repapp/orga/main.html",
@ -512,6 +515,7 @@ def orga(request):
'devices': devices,
'questions_not_sent': questions_not_sent,
'questions_open_and_answered': questions_open_and_answered,
'next_cafe': next_cafe,
}
)
@ -728,6 +732,26 @@ def question(request, question):
)
@login_required(login_url=reverse_lazy('member'))
def questions(request):
"""
List of all questions.
"""
# TODO: test
if not is_member(request.user):
raise PermissionDenied('Not organisator!')
questions = Question.objects.order_by('-date')
return render(
request,
"repapp/orga/questions.html",
{
'questions': questions,
}
)
@login_required(login_url=reverse_lazy('member'))
def select_role(request):
"""