Answer the question
In order to leave comments, you need to log in
How to write an analogue of “ListView.as_view” in Django in urls.py without a template?
How to write an analogue of "ListView.as_view" in Django in urls.py without a template?
"url(r'Author/(?P\d+)/', DetailView.as_view(model=Author))" works for detail entry,
but how to write similarly for displaying a list?
I try like this:
url(r'Authors', ListView.as_view(model=Author, paginate_by=25))
says - template is needed.
I would like to ideally get an auto form for displaying a list in one line and only according to the model, without forms, views, templates and other things
Answer the question
In order to leave comments, you need to log in
In order for Django to find the default template for a ListView, it must be named modelname_list.html . For example, if the model is named ' Post ', then the template should be named ' post_list.html '.
Don't forget the Zen of Python:
"Explicit is better than implicit."
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question