fix: Prevent creating a new object by passing instance

This commit is contained in:
moanos [he/him] 2024-05-30 16:38:55 +02:00
parent 56f03329ab
commit 4ffc7604c6

View File

@ -67,7 +67,7 @@ def adoption_notice_edit(request, adoption_notice_id):
""" """
adoption_notice = AdoptionNotice.objects.get(pk=adoption_notice_id) adoption_notice = AdoptionNotice.objects.get(pk=adoption_notice_id)
if request.method == 'POST': if request.method == 'POST':
form = AdoptionNoticeForm(request.POST) form = AdoptionNoticeForm(request.POST, instance=adoption_notice)
if form.is_valid(): if form.is_valid():
adoption_notice_instance = form.save() adoption_notice_instance = form.save()