Answer the question
In order to leave comments, you need to log in
Why does display on generic classes (Generic Editing Views) work incorrectly?
Hello everyone, I'm sitting here looking at the code and I don't understand what's wrong.
I have urls.py
urlpatterns = [
...
path(".../author/<id>/update/", AuthorUpdateView.as_view(), name="author-update-url"),
...
...
class AuthorUpdatePageView(UpdateView):
model = Author
fields = ["first_name", "last_name", "date_of_birth", "date_of_death"]
# В гайде работает без этого метода, пришлось переопределить
def get_object(self, queryset=None):
return Author.objects.get(id=self.kwargs.get("id"))
...
Generic detail view AuthorUpdatePageView must be called with either an object pk or a slug in the URLconf.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question