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