3 ms·
No, I believe you've read the code above incorrectly. This would be, for example: Todo.high_priority().all() and would allow, for example: Todo.high_pri
by jpwagner 14y ago
No, I believe you've read the code above incorrectly. This would be, for example:
Todo.high_priority().all()
and would allow, for example:
Todo.high_priority().filter(id__gte=1)
I haven't tested chaining these, but this might work:
Todo.high_priority().incomplete().filter(id__gte=1)
- j4mie 14y agoYour last example wouldn't work. Todo.high_priority() returns a plain QuerySet, which won't have your "incomplete" method (as that's defined on the Model class in your example).
- lojack 14y agoSorry, my example was explaining how it would be done if you were using Managers. Using your example: Todo.high_priority().incomplete() would fail because the QuerySet doesn't have an incomplete() method.