diff --git a/fbf/forms.py b/fbf/forms.py
index e8ca358..cd8246f 100644
--- a/fbf/forms.py
+++ b/fbf/forms.py
@@ -1,5 +1,3 @@
-from datetime import date
-
from django import forms
from django.utils.translation import gettext_lazy as _
@@ -10,7 +8,16 @@ class DateInput(forms.DateInput):
input_type = "date"
-class BirdForm(forms.ModelForm):
+class BirdAddForm(forms.ModelForm):
+ class Meta:
+ widgets = {"date_found": DateInput()}
+ model = FallenBird
+ fields = ["bird", "date_found", "place", ]
+ labels = {"bird": _("Vogel"), "date_found": _(
+ "Datum des Fundes"), "place": _("Fundort")}
+
+
+class BirdEditForm(forms.ModelForm):
class Meta:
widgets = {"date_found": DateInput()}
model = FallenBird
@@ -18,11 +25,11 @@ class BirdForm(forms.ModelForm):
"bird",
"date_found",
"place",
- # "rescuer",
+ "rescuer",
]
labels = {
"bird": _("Vogel"),
"date_found": _("Datum des Fundes"),
"place": _("Fundort"),
- # "rescuer": _("Finder"),
+ "rescuer": _("Retter"),
}
diff --git a/fbf/models.py b/fbf/models.py
index e797610..4723f41 100644
--- a/fbf/models.py
+++ b/fbf/models.py
@@ -1,6 +1,8 @@
-from django.db import models
-from django.conf import settings
from uuid import uuid4
+
+from django.conf import settings
+from django.db import models
+
from rescuer.models import Rescuer
diff --git a/fbf/templates/fbf/bird_create.html b/fbf/templates/fbf/bird_create.html
index 705bc43..728f61e 100644
--- a/fbf/templates/fbf/bird_create.html
+++ b/fbf/templates/fbf/bird_create.html
@@ -4,34 +4,15 @@
{% block content %}
Patient anlegen
+(Retter: {{rescuer.first_name}} {{rescuer.last_name}})
-
-
-{% endblock content %}
\ No newline at end of file
+{% endblock content %}
diff --git a/fbf/templates/fbf/bird_single.html b/fbf/templates/fbf/bird_single.html
index cc0cb71..d8a4cea 100644
--- a/fbf/templates/fbf/bird_single.html
+++ b/fbf/templates/fbf/bird_single.html
@@ -15,4 +15,4 @@
- {% endblock content %}
\ No newline at end of file
+ {% endblock content %}
diff --git a/fbf/views.py b/fbf/views.py
index 03fc67c..4e3e650 100644
--- a/fbf/views.py
+++ b/fbf/views.py
@@ -1,7 +1,7 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import HttpResponse, redirect, render
-from .forms import BirdForm
+from .forms import BirdAddForm, BirdEditForm
from .models import FallenBird
from rescuer.models import Rescuer
@@ -9,13 +9,13 @@ from rescuer.models import Rescuer
@login_required(login_url="account_login")
def bird_create(request):
# Rescuer for modal usage
- form = BirdForm()
+ form = BirdAddForm()
rescuer_id = request.session.get("rescuer_id")
rescuer = Rescuer.objects.get(id=rescuer_id, user=request.user)
# just show only related rescuers in select field of the form
if request.method == "POST":
- form = BirdForm(request.POST or None, request.FILES or None)
+ form = BirdAddForm(request.POST or None, request.FILES or None)
rescuer_id = request.session.get('rescuer_id')
rescuer = Rescuer.objects.get(id=rescuer_id, user=request.user)
@@ -54,7 +54,10 @@ def bird_recover_all(request):
@login_required(login_url="account_login")
def bird_single(request, id):
bird = FallenBird.objects.get(id=id)
- form = BirdForm(request.POST or None, request.FILES or None, instance=bird)
+ form = BirdEditForm(
+ request.POST or None,
+ request.FILES or None,
+ instance=bird)
if request.method == "POST":
if form.is_valid():
form.save()