refactor: Allow image upload for animals

This commit is contained in:
2024-03-20 13:40:00 +01:00
parent 58f45a69cc
commit b0b5b185d6
5 changed files with 43 additions and 15 deletions

View File

@@ -1,3 +1,4 @@
{% load static %}
<div class="detail-animal"></div>
<div class="detail-animal-header">
<h1 class="inline">{{ animal.name }}</h1>
@@ -16,4 +17,8 @@
</table>
</div>
<p>{{ animal.description }}</p>
<h2>Bilder</h2>
{% for image in animal.photos_list %}
<img src="/media/{{ image.image }}">
{% endfor %}
</div>

View File

@@ -2,12 +2,18 @@
{% load i18n %}
{% block content %}
<h1>Vermitteln</h1>
Hier kannst du jetzt einzelne Tiere zu deiner Vermittlung hinzufügen. Lad auch gerne Fotos hoch. Gruppenfotos kannst du im nächsten Schritt hochladen.
<form method = "post" enctype="multipart/form-data">
<h1>Vermitteln</h1>
Hier kannst du jetzt einzelne Tiere zu deiner Vermittlung hinzufügen. Lad auch gerne Fotos hoch. Gruppenfotos kannst
du im nächsten Schritt hochladen.
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<input type="file" name="picture">
<div class="form-animal">
{{ form.as_p }}
</div>
<div class="form-image">
<h2>Bild hinzufügen</h2>
{{ image_form.as_p }}
</div>
<button name="button_add_another_animal" type="submit">Speichern und nächstes Tier hinzufügen</button>
<button name="button_save_and_continue" type="submit">Speichern und weiter</button>
</form>