Changes between Initial Version and Version 1 of Ticket #21703, comment 5


Ignore:
Timestamp:
Jan 24, 2014, 4:53:45 AM (10 years ago)
Author:
Anssi Kääriäinen

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21703, comment 5

    initial v1  
    1 This one is complex to solve. In the query F('date') must refer the outer query's date field, not anything in the inner query. The way split_exclude() is implemented is to add `.filter(ownre__things__date=F('date'))` in the inner query, then trimming prefixes. We could add the F() into the outer query and pass that value to the inner query. Unfortunately that doesn't work if the F() object references something in the inner query (for example `F('owner__things__somecol')`). In that case we must add the F() to the outer query. In addition, this gets even more complicated if you use `F('date') + F('owner__things__somecol')`. Neither inner nor outer query addition works, the first F() needs to refer to outer, the second to inner query.
     1This one is complex to solve. In the query F('date') must refer the outer query's date field, not anything in the inner query. The way split_exclude() is implemented is to add `.filter(ownre__things__date=F('date'))` in the inner query, then trimming prefixes. We could add the F() into the outer query and pass that value to the inner query. Unfortunately that doesn't work if the F() object references something in the outer instead of inner query (for example `F('owner__things__somecol')`). In that case we must add the F() to the outer query. This gets even more complicated if you use `F('date') + F('owner__things__somecol')`. Neither inner nor outer query addition works for the whole expression, the first F() needs to refer to outer, the second to inner query.
    22
    33So, we need bigger changes into the ORM. I think we need to teach setup_joins() to auto-refer to the right query based on prefix, and rework how split_exclude() works. I don't have good ideas of how to actually achieve all this. It seems implementing this is going to need a lot of work.
Back to Top