Top "Django-queryset" questions

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

django most efficient way to count same field values in a query

Lets say if I have a model that has lots of fields, but I only care about a charfield. Lets …

django django-models django-queryset
Use "contains" and "iexact" at the same query in DJANGO

How can I use contains and iexact Field lookups at the same query in Django? Like that .. casas = Casa.objects.…

python django django-queryset
Custom QuerySet and Manager without breaking DRY?

I'm trying to find a way to implement both a custom QuerySet and a custom Manager without breaking DRY. This …

django django-models django-queryset django-managers
Django: change the value of a field for all objects in a queryset

I have a model MyModel with a boolean field active Elsewhere, I am retrieving a queryset: qs = MyModel.Objects.filter(....) …

python django django-queryset
manually create a Django QuerySet or rather manually add objects to a QuerySet

Basically I need a graceful way to do the following:- obj1 = Model1.objects.select_related('model2').get(attribute1=…

django django-queryset
Difference between Django's annotate and aggregate methods?

Django's QuerySet has two methods, annotate and aggregate. The documentation says that: Unlike aggregate(), annotate() is not a terminal clause. …

django django-queryset
OR operator in Django model queries

I'm trying to use an OR operator in the Django filter() function. Right now I have contactlist = Contact.objects.filter(…

django django-models django-queryset
How to create a Django queryset filter comparing two date fields in the same model

Trying to get a query where the Activity record is stale in my Solr Index. I want to check to …

django django-queryset
Django: filtering queryset by 'field__isnull=True' or 'field=None'?

I have to filter a queryset by a dynamic value (which can be None): may I simply write: filtered_queryset = …

django django-models django-queryset isnull
Django: Does prefetch_related() follow reverse relationship lookup?

I've tried prefetch_related() in django 1.4 from trunk and can't make it to prefetch reverse lookup. My simplified models (each …

django django-models django-queryset