Changes between Initial Version and Version 1 of Ticket #34597, comment 2


Ignore:
Timestamp:
May 28, 2023, 10:19:52 AM (19 months ago)
Author:
Lorand Varga

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34597, comment 2

    initial v1  
    118118I've managed to use your advice and modify the query to force the subquery to use IN but that leads to synthax that is more complex, while the django 2.2 synthax is a lot simpler: ~Q(translation=None)
    119119
    120 The only synthax that manages to replicate the query correctly (and performance wise) seems to be
    121 {{{qs.exclude(id__in=Blog.objects.filter(translation=None, id=OuterRef("id")))}}}}
     120The only synthax that manages (in django 3.2) to replicate the query correctly (and performance wise as in django2.2) seems to be
     121{{{qs.exclude(id__in=Blog.objects.filter(translation=None, id=OuterRef("id")))}}}
    122122
    123123While not terrible I do think something has been broken in django since the ~Q(translation=None) seems a lot cleaner and more ORMish.
Back to Top