Maybe you should use ListView, not DetailView.
2019年11月25日(月) 19:44 Manos Zeakis :
> Hi
>
> I have declared a model and the simple views I created are working.
>
> Now I am trying to move to generic views.
>
> So I added in urls.py
>
> path('book2//', views.DetailView.as_view(), name='detail'
Sorry, I mistaked.
You can use Detail view.
DetailView pass your model data, which named "book"(because model name is
Book).
Model doesn't list.
2019年11月25日(月) 19:44 Manos Zeakis :
> Hi
>
> I have declared a model and the simple views I created are working.
>
> Now I am trying to move to generic
Hi
I have declared a model and the simple views I created are working.
Now I am trying to move to generic views.
So I added in urls.py
path('book2//', views.DetailView.as_view(), name='detail'),
And in views.py
class DetailView(generic.DetailView):
model = Book
And the template is
3 matches
Mail list logo