Top "Django-queryset" questions

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

Using extra() on ValuesQuerySet in Django

I'm trying to calculate a percentage with two values which are themselves aggregated. The SQL query that explains what I'm …

sql django django-queryset extra
Django best way to check the model type of a queryset

I have a Django action function which I would like to use on querysets based on different models. What is …

django action django-queryset
Django "update_or_create" API: how to filter objects by created or updated?

So, I'm using the Django update_or_create API to build my form data. It works fine...but, once built, …

python django django-queryset django-filter
Django: ManyToMany filter matching on ALL items in a list

I have such a Book model: class Book(models.Model): authors = models.ManyToManyField(Author, ...) ... In short: I'd like to retrieve …

django django-queryset manytomanyfield django-orm
Filter Django Haystack results like QuerySet?

Is it possible to combine a Django Haystack search with "built-in" QuerySet filter operations, specifically filtering with Q() instances and …

django django-queryset django-haystack
Django: remove a filter condition from a queryset

I have a third-party function which gives me a filtered queryset (e.g. records with 'valid'=True) but I want …

django django-models filtering django-queryset
Django queryset - Adding HAVING constraint

I have been using Django for a couple of years now but I am struggling today with adding a HAVING …

django group-by sum django-queryset having
Calling filter with a variable for field name

Is there a way to call filter on a queryset where one of the fieldnames is a variable? For example …

django django-models django-queryset
How to do many-to-many Django query to find book with 2 given authors?

I have a query that requires to filter exactly 2 authors with the ID Theoretically, Book.objects.filter(author__id=1, author__…

python django many-to-many django-queryset
Django query to join records of two tables

I am using django-mssql 1.6.2 package with django 1.7 to get one or several records of tables from sql server 2008. When I …

django python-3.x django-models django-queryset django-mssql