Answer the question
In order to leave comments, you need to log in
How to display months from database?
Here is a list of dates with posts
The database has posts with publication dates, you need to group these dates into a month, year, count their number and output.
Answer the question
In order to leave comments, you need to log in
groups = Post.objects.values('pub_date__year', 'pub_date__month').annotate(count=Count('pk'))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question