S
S
Shporsoft2020-11-04 15:57:06
Django
Shporsoft, 2020-11-04 15:57:06

How to display the total number of views?

Let's say I have a Posts model that has a views field (IntegerField) how do I count the total number of views of all articles? Somehow, of course, I tried with a for loop, but it didn’t work out. If in more detail, then I have three articles and each of them has its own number of views. You just need to find out in the total number of views.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-11-04
@Shporsoft

https://docs.djangoproject.com/en/3.1/ref/models/q...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question