59👍
✅
Employer.objects.values('id').annotate(jobtitle_count=Count('jobtitle')).order_by('-jobtitle_count')[:5]
11👍
from django.db.models import Count
Employer.objects.annotate(Count('jobtitle')).order_by('-jobtitle__count')[:5]
👤Jj.
- [Django]-Setting DEBUG = False causes 500 Error
- [Django]-Separating form input and model validation in Django?
- [Django]-How to automatically login a user after registration in django
Source:stackexchange.com