Good evening, everyone. This is my first post in the forum and I am also a bit lazy in django. I'm developing a project that involves a model called Art and in one of the views I need to do the data update. I made the whole part of the form and it arrives in the template, but when I click on the button to save the changes I get the error "Art matching query does not exist."
Below is the code for the view. If you need any more, I'm at your disposal. Thanks in advance.
def editarte(request):
id_arte = request.GET.get("id")
arte = Arte.objects.get(id = id_arte)
formEditArte = EditArteModelForm(request.POST or None, instance = arte)
if request.method == 'POST':
if formEditArte.is_valid():
arte.save()
return redirect('/editarte')
formEditArte = EditArteModelForm()
context = {
'formEditArte' : formEditArte,
'arte': arte
}
return render(request, 'editarte.html', context)