django get first item in queryset code example
Example 1: how to get only first record in django
MyModel.objects.filter(blah=blah).first()
Example 2: django queryset first element
queryset.first()
Example 3: query first 5 element in django
Employer.objects.values('id').annotate(jobtitle_count=Count('jobtitle')).order_by('-jobtitle_count')[:5]