Python Django UpdateView: 404 not found

21 Views Asked by At

I'm using the built in class based views, in this case the UpdateView. The documentation doesn't give any hints towards how the urls.py must look like. Which url pattern is matched by that generic view, so that I can update a particular object (e.g. with id 1 in the database)? I tried:

path("myroute/<int:pk>/", views.myUpdateView.as_view(), name="myname")

The view behind views.myUpdateView is a django.views.generic.edit.UpdateView and when I navigate to let's say myroute/1/ I get a 404 error. How am I supposed to use that generic view? I was just guessing that it must somehow fetch the pk parameter from my URL, but I see no documentation for that part? Sorry for not including the template ecetera, but it's not really needed here because my question is so simple: which url pattern(s) is (are) processed by the UpdateView? Did I overlook something in the documentation? Thank you in advance!

0

There are 0 best solutions below