Back
Sep 23, 2010

OR and AND without django.db.models.Q

Vladimir Sidorenko
Vladimir Sidorenko

I just found out that orand andare defined for QuerySet. This means that to do queries union or intersection, you can do:

User.objects.filter(...) | User.objects.filter(...)
    User.objects.filter(...) & User.objects.filter(...)

More thoughts

Jan 10, 2017Technology
How To Use GraphQL with Angular 2 (with Example)

​In this article we will tell you about the basics of working with GraphQL in Angular 2 environment with detailed example.

Alexandr Selyanov
Alexandr Selyanov
Jun 01, 2018Technology
Site search organization: basic concepts

Now it's time to get acquainted with Elasticsearch. This NoSQL database is used to store logs, analyze information and - most importantly - search.

Viktor Tyshchenko
Viktor Tyshchenko
Sep 21, 2020Technology
How to Optimize Django ORM Queries

Django ORM is a very abstract and flexible API. But if you do not know exactly how it works, you will likely end up with slow and heavy views, if you have not already. So, this article provides practical solutions to N+1 and high loading time issues. For clarity, I will create a simple view that demonstrates common ORM query problems and shows frequently used practices.

Alexey Demianenko
Alexey Demianenko
Jun 25, 2011Technology
Ajax blocks in Django

Quite often we have to write paginated or filtered blocks of information on page. I created a decorator that would automate this process.

Vladimir Sidorenko
Vladimir Sidorenko