aviary overview
This commit is contained in:
parent
67140c2e64
commit
ab57baa4f8
6 changed files with 113 additions and 34 deletions
|
@ -0,0 +1,60 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% block header %}
|
||||
<!-- Datatable CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css" />
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.bootstrap5.min.css">
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
|
||||
|
||||
<!-- Datatable jQuery -->
|
||||
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.11.3/js/dataTables.bootstrap5.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/responsive/2.2.9/js/responsive.bootstrap5.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#t__aviary_all').DataTable({
|
||||
language: {
|
||||
url: 'https://cdn.datatables.net/plug-ins/1.11.3/i18n/de_de.json',
|
||||
},
|
||||
paging: false,
|
||||
info: false,
|
||||
responsive: true,
|
||||
columnDefs: [
|
||||
{ responsivePriority: 1, targets: 0 },
|
||||
]
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
{% endblock header %}
|
||||
{% block content %}
|
||||
<h3>Übersicht aller Volieren</h3>
|
||||
<p>
|
||||
Die Übersicht aller Volieren.
|
||||
</p>
|
||||
<table class="table table-striped table-hover display responsive nowrap" width="100%" id="t__aviary_all">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bezeichnung</th>
|
||||
<th>Zustand</th>
|
||||
<th>letzte Inspektion</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for aviary in aviaries %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'aviary_single' aviary.id %}">{{ aviary.description }}</a>
|
||||
</td>
|
||||
<td>{{ aviary.condition }}</td>
|
||||
<td>{{ aviary.last_ward_round }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock content %}
|
0
aviary/templates/aviary/aviary_single.html
Normal file
0
aviary/templates/aviary/aviary_single.html
Normal file
|
@ -1,9 +1,11 @@
|
|||
from django.urls import path
|
||||
|
||||
from .views import (
|
||||
aviary_all
|
||||
aviary_all,
|
||||
aviary_single
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
path("all/", aviary_all, name="aviary_all"),
|
||||
path("<id>", aviary_single, name="aviary_single"),
|
||||
]
|
||||
|
|
|
@ -9,3 +9,10 @@ def aviary_all(request):
|
|||
aviaries = Aviary.objects.all()
|
||||
context = {"aviaries": aviaries}
|
||||
return render(request, "aviary/aviary_all.html", context)
|
||||
|
||||
|
||||
@login_required(login_url="account_login")
|
||||
def aviary_single(request, id):
|
||||
aviary = Aviary.objects.get(id=id)
|
||||
context = {"aviary": aviary}
|
||||
return render(request, "aviary/aviary_single.html", context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue