aviary first view and template
This commit is contained in:
parent
462b9ff224
commit
5e5605524f
8 changed files with 61 additions and 21 deletions
|
@ -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
|
||||
|
|
0
aviary/templates/aviary/aviary_all.html
Normal file
0
aviary/templates/aviary/aviary_all.html
Normal file
9
aviary/urls.py
Normal file
9
aviary/urls.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django.urls import path
|
||||
|
||||
from .views import (
|
||||
aviary_all
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
path("all/", aviary_all, name="aviary_all"),
|
||||
]
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue