aviary first view and template

This commit is contained in:
gw3000 2023-07-01 09:21:58 +02:00
parent 462b9ff224
commit 5e5605524f
8 changed files with 61 additions and 21 deletions

View file

@ -1,12 +1,19 @@
from uuid import uuid4
from django.db import models
from django.utils.translation import gettext_lazy as _
class Aviary(models.Model):
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
description = models.CharField(max_length=256)
condition = models.CharField(max_length=256)
last_ward_round = models.DateField()
description = models.CharField(
max_length=256, verbose_name=_("Beschreibung"))
condition = models.CharField(max_length=256, verbose_name=_("Zustand"))
last_ward_round = models.DateField(verbose_name=_("letzte Visite"))
class Meta:
verbose_name = _("Voliere")
verbose_name_plural = _("Volieren")
def __str__(self):
return self.description

View file

9
aviary/urls.py Normal file
View file

@ -0,0 +1,9 @@
from django.urls import path
from .views import (
aviary_all
)
urlpatterns = [
path("all/", aviary_all, name="aviary_all"),
]

View file

@ -1,3 +1,11 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
# Create your views here.
from .models import Aviary
@login_required(login_url="account_login")
def aviary_all(request):
aviaries = Aviary.objects.all()
context = {"aviaries": aviaries}
return render(request, "aviary/aviary_all.html", context)