refactor: Streamline urls, add adoption notice edit

This commit is contained in:
moanos [he/him] 2024-05-30 09:54:54 +02:00
parent 0a305f0aa5
commit c9cd63b6a0
2 changed files with 7 additions and 4 deletions

View File

@ -10,13 +10,13 @@ urlpatterns = [
path("", views.index, name="index"), path("", views.index, name="index"),
path("rss/", LatestAdoptionNoticesFeed(), name="rss"), path("rss/", LatestAdoptionNoticesFeed(), name="rss"),
# ex: /animal/5/ # ex: /animal/5/
path("<int:animal_id>/", views.animal_detail, name="animal-detail"), path("tier/<int:animal_id>/", views.animal_detail, name="animal-detail"),
# ex: /animal/5/edit # ex: /animal/5/edit
path("<int:animal_id>/edit", views.change_animal, name="animal-edit"), path("tier<int:animal_id>/edit", views.animal_edit, name="animal-edit"),
# 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"),
# ex: /adoption_notice/7/edit # ex: /adoption_notice/7/edit
path("vermittlung/<int:adoption_notice_id>/edit", views.change_animal, name="adoption-notice-edit"), path("vermittlung/<int:adoption_notice_id>/edit", views.adoption_notice_edit, name="adoption-notice-edit"),
# ex: /search/ # ex: /search/
path("suchen/", views.search, name="search"), path("suchen/", views.search, name="search"),

View File

@ -46,6 +46,9 @@ def adoption_notice_detail(request, adoption_notice_id):
context = {"adoption_notice": adoption_notice} context = {"adoption_notice": adoption_notice}
return render(request, 'fellchensammlung/details/detail_adoption_notice.html', context=context) 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): def animal_detail(request, animal_id):
animal = Animal.objects.get(id=animal_id) animal = Animal.objects.get(id=animal_id)
@ -121,7 +124,7 @@ def edit_adoption_notice(request, animal_id):
@login_required @login_required
def change_animal(request, animal_id): def animal_edit(request, animal_id):
""" """
View implements the following methods View implements the following methods
* Updating an Animal * Updating an Animal