From c9cd63b6a0ea0e5746aa1fea3a7efd2c8c2487e8 Mon Sep 17 00:00:00 2001 From: moanos Date: Thu, 30 May 2024 09:54:54 +0200 Subject: [PATCH] refactor: Streamline urls, add adoption notice edit --- src/fellchensammlung/urls.py | 6 +++--- src/fellchensammlung/views.py | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/fellchensammlung/urls.py b/src/fellchensammlung/urls.py index d2349ce..87093d3 100644 --- a/src/fellchensammlung/urls.py +++ b/src/fellchensammlung/urls.py @@ -10,13 +10,13 @@ urlpatterns = [ path("", views.index, name="index"), path("rss/", LatestAdoptionNoticesFeed(), name="rss"), # ex: /animal/5/ - path("/", views.animal_detail, name="animal-detail"), + path("tier//", views.animal_detail, name="animal-detail"), # ex: /animal/5/edit - path("/edit", views.change_animal, name="animal-edit"), + path("tier/edit", views.animal_edit, name="animal-edit"), # ex: /adoption_notice/7/ path("vermittlung//", views.adoption_notice_detail, name="adoption-notice-detail"), # ex: /adoption_notice/7/edit - path("vermittlung//edit", views.change_animal, name="adoption-notice-edit"), + path("vermittlung//edit", views.adoption_notice_edit, name="adoption-notice-edit"), # ex: /search/ path("suchen/", views.search, name="search"), diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index c4d2e55..af78dee 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -46,6 +46,9 @@ def adoption_notice_detail(request, adoption_notice_id): context = {"adoption_notice": adoption_notice} return render(request, 'fellchensammlung/details/detail_adoption_notice.html', context=context) +def adoption_notice_edit(request, adoption_notice_id): + form = AdoptionNoticeForm() + return render(request, 'fellchensammlung/forms/form-adoption-notice.html', context={"form": form}) def animal_detail(request, animal_id): animal = Animal.objects.get(id=animal_id) @@ -121,7 +124,7 @@ def edit_adoption_notice(request, animal_id): @login_required -def change_animal(request, animal_id): +def animal_edit(request, animal_id): """ View implements the following methods * Updating an Animal