count the number of rows in a database table in Django

use ".count()"

Example:-
Number_of_Messages = Messages.objects.count()

Here is what the above code is Doing:
1. It’s using the Messages model to query the database.
2. It’s using the count() method to count the number of messages in the database.
3. It’s storing the result in a variable called Number_of_Messages.