Top "Django-queryset" questions

Django querysets are the primary abstraction for retrieving objects from Django's ORM system

How to annotate Count with a condition in a Django queryset

Using Django ORM, can one do something like queryset.objects.annotate(Count('queryset_objects', gte=VALUE)). Catch my drift? Here's …

python django django-queryset
Get the index of an element in a queryset

I have a QuerySet, let's call it qs, which is ordered by some attribute which is irrelevant to this problem. …

python django indexing django-queryset
Django query where in

How to do this using django object query: SELECT * FROM test WHERE (test_id IN (SELECT test_id FROM test_…

django django-queryset
how to create an empty queryset and to add objects manually in django

I need to create a queryset and to add manually some objects that i've got from different queries results in …

django django-queryset
Django objects.filter() values_list() vs python list comprehension for __in query

I have a quirk(?) with Django queryset filtering: ipdb> MagazineIssue.objects.filter(id__in=l_magazines.values_list('id')) …

python django django-models django-queryset
JSON Serializing Django Models with simplejson

I'd like to use simplejson to serialize a Django model. Django's serializer doesn't support dictionaries... and simplejson doesn't support Django …

django json serialization django-queryset
Django excluding specific instances from queryset without using field lookup

I sometimes have the need to make sure some instances are excluded from a queryset. This is the way I …

django filtering django-queryset
Django: How to write query to sort using multiple columns, display via template

I'm quite new to Django, and not too experienced with MVC, DB queries. I have a Customer table which includes …

python django postgresql sorting django-queryset
What is a Django QuerySet?

When I do this, >>> b = Blog.objects.all() >>> b I get this: >>&…

django django-queryset
Django Aggregation: Summation of Multiplication of two fields

I have a model something like this: class Task(models.Model): progress = models.PositiveIntegerField() estimated_days = models.PositiveIntegerField() Now I …

python django django-models django-queryset django-orm