1👍
✅
You can order the cities with maximum number of Architects like this –
City.objects.filter(user__Iam='Architect').annotate(num_user=Count('user')).order_by('-num_user')
This first filters cities that have architects, then counts the architects and then order by them in descending order.
Source:stackexchange.com