S
S
Sergey Nizhny Novgorod2016-06-04 03:41:01
Django
Sergey Nizhny Novgorod, 2016-06-04 03:41:01

How to display the number of records in a model/view in Django?

Hello.
The task is simple:
There is a model of the article. You need to display the number of articles per page. How can this be done better? Is there any special request from the view for such a purpose?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2016-06-04
@Terras

>>> count = MyModel.objects.all().count()
>>> count
2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question