From c8ef310a71a42dc8cdd4d5dabcc4d1409b03d2e6 Mon Sep 17 00:00:00 2001 From: moanos Date: Thu, 8 Aug 2024 13:27:08 +0200 Subject: [PATCH] feat: Make sure location gets refreshed when editing AN --- src/fellchensammlung/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index fe8c00f..1cafac5 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -119,6 +119,10 @@ def adoption_notice_edit(request, adoption_notice_id): if form.is_valid(): adoption_notice_instance = form.save() + """Search the location given in the location string and add it to the adoption notice""" + location = Location.get_location_from_string(adoption_notice_instance.location_string) + adoption_notice_instance.location = location + adoption_notice_instance.save() return redirect(reverse("adoption-notice-detail", args=[adoption_notice_instance.pk], )) else: form = AdoptionNoticeForm(instance=adoption_notice)