Geschlecht Patient #32

This commit is contained in:
gw3000 2023-07-22 22:14:06 +02:00
parent 4f842b0311
commit b1a10b26f1
5 changed files with 22 additions and 43 deletions

View file

@ -8,12 +8,14 @@ class FallenBirdAdmin(admin.ModelAdmin):
list_display = [
"bird",
"age",
"sex",
"date_found",
"place",
"created",
"updated",
"user",
"status"]
"status",
]
list_filter = ("bird", "created", "user", "status")

View file

@ -11,18 +11,16 @@ class DateInput(forms.DateInput):
class BirdAddForm(forms.ModelForm):
class Meta:
widgets = {
"date_found": DateInput(
format="%Y-%m-%d",
attrs={
"value": date.today})}
"date_found": DateInput(format="%Y-%m-%d", attrs={"value": date.today})
}
model = FallenBird
fields = [
"bird_identifier",
"bird",
"age",
"sex",
"date_found",
"place",
"find_circumstances",
@ -32,6 +30,7 @@ class BirdAddForm(forms.ModelForm):
"bird_identifier": _("Kennung"),
"bird": _("Vogel"),
"age": _("Alter"),
"sex": _("Geschlecht"),
"date_found": _("Datum des Fundes"),
"place": _("Fundort"),
"find_circumstances": _("Fundumstände"),
@ -46,6 +45,7 @@ class BirdEditForm(forms.ModelForm):
fields = [
"bird_identifier",
"bird",
"sex",
"date_found",
"place",
"status",
@ -56,6 +56,7 @@ class BirdEditForm(forms.ModelForm):
]
labels = {
"bird": _("Vogel"),
"sex": _("Geschlecht"),
"date_found": _("Datum des Fundes"),
"place": _("Fundort"),
"status": _("Status"),

View file

@ -17,6 +17,12 @@ CHOICE_AGE = [
("Adult", "Adult"),
]
CHOICE_SEX = [
("Weiblich", "Weiblich"),
("Männlich", "Männlich"),
("Unbekannt", "Unbekannt"),
]
def costs_default():
return [{"date": date.today().strftime("%Y-%m-%d"), "cost_entry": "0.00"}]
@ -28,10 +34,9 @@ class FallenBird(models.Model):
bird = models.ForeignKey(
"Bird", on_delete=models.CASCADE, verbose_name=_("Patient")
)
age = models.CharField(
max_length=15,
choices=CHOICE_AGE,
verbose_name=_("Alter")
age = models.CharField(max_length=15, choices=CHOICE_AGE, verbose_name=_("Alter"))
sex = models.CharField(
max_length=15, choices=CHOICE_SEX, verbose_name=_("Geschlecht")
)
date_found = models.DateField(verbose_name=_("Datum des Fundes"))
place = models.CharField(max_length=256, verbose_name=_("Ort des Fundes"))

View file

@ -61,6 +61,7 @@
<th>Voliere</th>
<th>Kosten</th>
<th>Alter</th>
<th>Geschlecht</th>
</tr>
</thead>
<tbody>
@ -77,6 +78,7 @@
<td>{{ bird.aviary|default_if_none:"" }}</td>
<td>{{ bird.total_costs|default_if_none:"0,00" }} &euro;</td>
<td>{{ bird.age|default_if_none:"" }}</td>
<td>{{ bird.sex }}</td>
</tr>
{% endfor %}
</tbody>

View file

@ -54,6 +54,7 @@
<th>Status</th>
<th>Kosten</th>
<th>Alter</th>
<th>Geschlecht</th>
</tr>
</thead>
<tbody>
@ -69,41 +70,9 @@
<td>{{ bird.status }}</td>
<td>{{ bird.total_costs|default_if_none:"0,00" }} &euro;</td>
<td>{{ bird.age|default_if_none:"" }} </td>
<td>{{ bird.sex }} </td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="modal fade" id="addPatientModal" tabindex="-1" data-bs-backdrop="static"
aria-labelledby="addRescuerModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-primary">
<h5 class="modal-title text-white" id="addRescuerModalLabel">(neuen) Finder zuweisen</h5>
</div>
<form method="post">
{% csrf_token %}
<div class="modal-body">
<label for="rescuer" class="form-label mt-3">Wählen Sie einen <strong>bereits angelegten</strong>
Finder aus oder legen Sie einen <strong>neuen</strong> Finder an:</label>
<select id="rescuer" class="form-select" name="rescuer_id">
<option value="new_rescuer"><strong>neuen
Finder anlegen</strong></option>
{% for rescuer in rescuer_modal %}
<option value={{rescuer.id}}>
{{rescuer.first_name}} {{rescuer.last_name}},
{{rescuer.street}} {{rescuer.street_number}},
{{rescuer.city}}
</option>
{% endfor %}
</select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Abbruch</button>
<button class="btn btn-primary" type="submit">Übernehmen und weiter</button>
</div>
</div>
</div>
</div>
</form>
{% endblock content %}