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)
|
||||
|
|
|
@ -2,36 +2,39 @@ from uuid import uuid4
|
|||
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from aviary.models import Aviary
|
||||
from rescuer.models import Rescuer
|
||||
|
||||
|
||||
# STATUS = [
|
||||
# ("In Behandlung", "In Behandlung"),
|
||||
# ("In Auswilderung", "In Auswilderung"),
|
||||
# ("Ausgewildert", "Ausgewildert"),
|
||||
# ("Verstorben", "Verstorben"),
|
||||
# ]
|
||||
|
||||
|
||||
class FallenBird(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
|
||||
bird = models.ForeignKey("Bird", on_delete=models.CASCADE)
|
||||
date_found = models.DateField()
|
||||
place = models.CharField(max_length=256)
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
updated = models.DateTimeField(auto_now=True)
|
||||
bird = models.ForeignKey(
|
||||
"Bird",
|
||||
on_delete=models.CASCADE,
|
||||
verbose_name=_("Patient"))
|
||||
date_found = models.DateField(verbose_name=_("Datum des Fundes"))
|
||||
place = models.CharField(max_length=256, verbose_name=_("Ort des Fundes"))
|
||||
created = models.DateTimeField(
|
||||
auto_now_add=True,
|
||||
verbose_name=_("angelegt am"))
|
||||
updated = models.DateTimeField(
|
||||
auto_now=True, verbose_name=_("geändert am"))
|
||||
diagnostic_finding = models.CharField(max_length=256)
|
||||
cost_sum = models.DecimalField(max_digits=4, decimal_places=2)
|
||||
rescuer = models.ForeignKey(
|
||||
Rescuer, on_delete=models.SET_NULL, blank=True, null=True)
|
||||
user = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||
aviary = models.ForeignKey(
|
||||
Aviary, on_delete=models.SET_NULL, blank=True, null=True)
|
||||
status = models.ForeignKey(
|
||||
"BirdStatus", on_delete=models.SET_NULL, blank=True, null=True)
|
||||
aviary = models.ForeignKey(
|
||||
Aviary, on_delete=models.SET_NULL, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Patient")
|
||||
verbose_name_plural = _("Patienten")
|
||||
|
||||
def __str__(self):
|
||||
return self.place
|
||||
|
@ -41,6 +44,10 @@ class Bird(models.Model):
|
|||
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
|
||||
name = models.CharField(max_length=256)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Vogel")
|
||||
verbose_name_plural = _("Vögel")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
@ -49,5 +56,9 @@ class BirdStatus(models.Model):
|
|||
id = models.UUIDField(primary_key=True, default=uuid4, editable=False)
|
||||
description = models.CharField(max_length=256)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Patientenstatus")
|
||||
verbose_name_plural = _("Patientenstatus")
|
||||
|
||||
def __str__(self):
|
||||
return self.description
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{% block content %}
|
||||
<h3>Patient {{ bird.bird }} bearbeiten</h3>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 mb-3">
|
||||
<div class="col-lg-5 mb-3">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -21,6 +21,7 @@ urlpatterns = [
|
|||
# Dynamic sites
|
||||
path("bird/", include("bird.urls")),
|
||||
path("rescuer/", include("rescuer.urls")),
|
||||
path("aviary/", include("aviary.urls")),
|
||||
# Admin
|
||||
path("admin/", admin.site.urls),
|
||||
# Allauth
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
<a class="nav-link {% if '/rescuer/all' in request.path %} active {% endif %}"
|
||||
href="{% url 'rescuer_all' %}">alle Retter</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if '/aviary/all' in request.path %} active {% endif %}"
|
||||
href="{% url 'aviary_all' %}">alle Volieren</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
|
@ -41,4 +45,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<br />
|
||||
<br />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue