Thank you all for the replies.
@Josh Smeaton
Essentially yes; specifically I was wondering whether I was failing to
consider behaviour that couldn't be modeled via a Q object, since as you
mention the current
These queries are actually not equivalent. Consider the following code:
>>> r = Related.objects.create(field='related')
>>> r.main_set.create(field_one='1', field_two='3')
>>> r.main_set.create(field_one='2', field_two='4')
>>>
It sounds like you understand what the current behaviour is, and you think
that it would be better modelled with Q objects, is that the case? I can
see where you're coming from, as even the docs explain the difference
loosely in terms of AND and OR.
Q(entry__headline__contains='Lennon') &
On 03/30/2018 08:57 AM, Ryan Hiebert wrote:
It's a subtle difference between how a single filter works and two
filters work together over to-many relationships. Here's a writeup that
I found helpful:
https://blog.ionelmc.ro/2014/05/10/django-sticky-queryset-filters/
It's also addressed in
It's a subtle difference between how a single filter works and two filters
work together over to-many relationships. Here's a writeup that I found
helpful: https://blog.ionelmc.ro/2014/05/10/django-sticky-queryset-filters/
On Thu, Mar 29, 2018 at 4:26 PM, Andrew Standley
I have recently become acquainted with some ORM behaviour for reverse
relationships that "makes no sense", and I'm hoping someone can explain the
justification for the current behaviour.
This specifically relates to `filter` behaviour referenced in 29271