refactor: Remove non-bulma add image
This commit is contained in:
@@ -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})
|
||||
|
||||
|
||||
@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
|
||||
def add_photo_to_animal_bulma(request, animal_id):
|
||||
|
Reference in New Issue
Block a user