Erster View und erstes Template angelegt, URL /speisekarte registriert.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Mensa-Speisekarte</title>
|
||||
<!-- Bootstrap CSS für schnelles Styling -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body class="bg-light">
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card shadow">
|
||||
<div class'card-header bg-primary text-white text-center py-3'>
|
||||
<h1><i class="bi bi-egg-fried"></i> Unsere Speisekarte</h1>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Gericht</th>
|
||||
<th>Kategorie</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for gericht in alle_gerichte %}
|
||||
<tr>
|
||||
<td><strong>{{ gericht.name }}</strong></td>
|
||||
<td><span class="badge bg-info text-dark">{{ gericht.kategorie.name }}</span></td>
|
||||
<td>
|
||||
{% if gericht.ist_dauerangebot %}
|
||||
<span class="badge bg-success">Dauerangebot</span>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary">Tagesangebot</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="3" class="text-center text-muted">Keine Gerichte im System gefunden.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
from django.urls import path
|
||||
from .views import GerichtListView
|
||||
|
||||
urlpatterns = [
|
||||
path('speisekarte/', GerichtListView.as_view(), name='gericht_list'),
|
||||
]
|
||||
@@ -1,3 +1,11 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
from django.views.generic import ListView
|
||||
from .models import Gericht
|
||||
|
||||
class GerichtListView(ListView):
|
||||
model = Gericht
|
||||
template_name = 'mensa_app/gericht_liste.html' # Der Pfad zum Template
|
||||
context_object_name = 'alle_gerichte' # Der Name, den wir im Template nutzen
|
||||
|
||||
|
||||
Reference in New Issue
Block a user