refactor: Remove non-bulma add image
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
Lade hier ein Foto hoch - wähle den Titel wie du willst und mach bitte eine Bildbeschreibung,
|
Lade hier ein Foto hoch - wähle den Titel wie du willst und mach bitte eine Bildbeschreibung,
|
||||||
damit die Fotos auch für blinde und sehbehinderte Personen zugänglich sind.
|
damit die Fotos auch für blinde und sehbehinderte Personen zugänglich sind.
|
||||||
{% endblocktranslate %}
|
{% endblocktranslate %}
|
||||||
<p><a class="button"
|
<p><a class="button" target="_blank"
|
||||||
href="https://www.dbsv.org/bildbeschreibung-4-regeln.html">{% translate 'Anleitung für Bildbeschreibungen' %}</a>
|
href="https://www.dbsv.org/bildbeschreibung-4-regeln.html">{% translate 'Anleitung für Bildbeschreibungen' %}</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
{% extends "fellchensammlung/base_generic.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
{% load crispy_forms_tags %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<p>
|
|
||||||
{% blocktranslate %}
|
|
||||||
Lade hier ein Foto hoch - wähle den Titel wie du willst und mach bitte eine Bildbeschreibung,
|
|
||||||
damit die Fotos auch für blinde und sehbehinderte Personen zugänglich sind.
|
|
||||||
{% endblocktranslate %}
|
|
||||||
<p><a class="btn2" href="https://www.dbsv.org/bildbeschreibung-4-regeln.html">{% translate 'Anleitung für Bildbeschreibungen' %}</a></p>
|
|
||||||
</p>
|
|
||||||
<div class="container-form">
|
|
||||||
{% crispy form %}
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@@ -60,7 +60,7 @@
|
|||||||
<a class="card-footer-item"
|
<a class="card-footer-item"
|
||||||
href="{% url 'animal-edit' animal_id=animal.pk %}">{% translate 'Bearbeiten' %}</a>
|
href="{% url 'animal-edit' animal_id=animal.pk %}">{% translate 'Bearbeiten' %}</a>
|
||||||
<a class="card-footer-item"
|
<a class="card-footer-item"
|
||||||
href="{% url 'animal-add-photo-bulma' animal_id=animal.pk %}">{% translate 'Foto hinzufügen' %}</a>
|
href="{% url 'animal-add-photo' animal_id=animal.pk %}">{% translate 'Foto hinzufügen' %}</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@@ -25,8 +25,7 @@ urlpatterns = [
|
|||||||
# ex: /animal/5/edit
|
# ex: /animal/5/edit
|
||||||
path("tier/<int:animal_id>/edit", views.animal_edit, name="animal-edit"),
|
path("tier/<int:animal_id>/edit", views.animal_edit, name="animal-edit"),
|
||||||
# ex: /animal/5/add-photo
|
# ex: /animal/5/add-photo
|
||||||
path("tier/<int:animal_id>/add-photo", views.add_photo_to_animal, name="animal-add-photo"),
|
path("tier/<int:animal_id>/add-photo", views.add_photo_to_animal_bulma, name="animal-add-photo"),
|
||||||
path("bulma/tier/<int:animal_id>/add-photo", views.add_photo_to_animal_bulma, name="animal-add-photo-bulma"),
|
|
||||||
# ex: /adoption_notice/7/
|
# ex: /adoption_notice/7/
|
||||||
path("vermittlung/<int:adoption_notice_id>/", views.adoption_notice_detail, name="adoption-notice-detail"),
|
path("vermittlung/<int:adoption_notice_id>/", views.adoption_notice_detail, name="adoption-notice-detail"),
|
||||||
path("bulma/vermittlung/<int:adoption_notice_id>/", views.adoption_notice_detail_bulma,
|
path("bulma/vermittlung/<int:adoption_notice_id>/", views.adoption_notice_detail_bulma,
|
||||||
|
@@ -314,34 +314,6 @@ def adoption_notice_add_animal(request, adoption_notice_id):
|
|||||||
return render(request, 'fellchensammlung/forms/form_add_animal_to_adoption.html', {'form': form})
|
return render(request, 'fellchensammlung/forms/form_add_animal_to_adoption.html', {'form': form})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def add_photo_to_animal(request, animal_id):
|
|
||||||
animal = Animal.objects.get(id=animal_id)
|
|
||||||
# Only users that are mods or owners of the animal are allowed to add to it
|
|
||||||
fail_if_user_not_owner_or_trust_level(request.user, animal)
|
|
||||||
if request.method == 'POST':
|
|
||||||
form = ImageForm(request.POST, request.FILES)
|
|
||||||
|
|
||||||
if form.is_valid():
|
|
||||||
instance = form.save(commit=False)
|
|
||||||
instance.owner = request.user
|
|
||||||
instance.save()
|
|
||||||
|
|
||||||
animal.photos.add(instance)
|
|
||||||
|
|
||||||
"""Log"""
|
|
||||||
Log.objects.create(user=request.user, action="add_photo_to_animal",
|
|
||||||
text=f"{request.user} hat Foto {instance.pk} zum Tier {animal.pk} hinzugefügt")
|
|
||||||
|
|
||||||
if "save-and-add-another" in request.POST:
|
|
||||||
form = ImageForm(in_flow=True)
|
|
||||||
return render(request, 'fellchensammlung/forms/form-image.html', {'form': form})
|
|
||||||
else:
|
|
||||||
return redirect(reverse("adoption-notice-detail", args=[animal.adoption_notice.pk], ))
|
|
||||||
else:
|
|
||||||
form = ImageForm(in_flow=True)
|
|
||||||
return render(request, 'fellchensammlung/forms/form-image.html', {'form': form})
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def add_photo_to_animal_bulma(request, animal_id):
|
def add_photo_to_animal_bulma(request, animal_id):
|
||||||
|
Reference in New Issue
Block a user