Top "Django-orm" questions

Django's ORM system, comprising its queryset and model systems.

Filtering Many-to-Many relationship by Relationship field in Django

I'm trying to filter many-to-many relationship by some through Class field. Quoting the Django documentation, i will explain my goal …

django filtering django-orm
django-orm case-insensitive order by

I know, I can run a case insensitive search from DJango ORM. Like, User.objects.filter(first_name__contains="jake") …

django case-insensitive fetch django-orm
Django ORM: Group by and Max

I have a model that looks like this: Requests: user, req_time, req_text In the DB, the records can …

django django-orm
Issue with ManyToMany Relationships not updating immediately after save

I'm having issues with ManytoMany Relationships that are not updating in a model when I save it (via the admin) …

django django-admin django-orm django-signals
ModelSerializer is extremely slow in Django REST framework

I am using Django REST framework for my API and yesterday I wanted to see how it works for large …

django django-rest-framework django-orm django-serializer
In django, is there a way to directly annotate a query with a related object in single query?

Consider this query: query = Novel.objects.< ...some filtering... >.annotate( latest_chapter_id=Max("volume__chapter__id") ) Actually what …

python django django-orm annotate
Using Django's m2m_changed to modify what is being saved pre_add

I am not very familiar with Django's signals and could use some help. How do I modified the pk_set …

python django django-signals django-orm m2m
Django queryset filter - Q() | VS __in

What is the difference between queryset.filter(Q(foo='bar') | Q(foo='baz')) and queryset.filter(foo__in=['bar', 'baz']) …

django filter django-queryset django-orm django-q
Django ORM, group by day

I am trying to group products by DAY, however date_created is a datetime field. Product.objects.values('date_created') \ .…

python mysql django django-orm
Determine if an attribute is a `DeferredAttribute` in django

The Context I have located a rather critical bug in Django Cache Machine that causes it's invalidation logic to lose …

python django django-models django-orm django-cache-machine