Make nested lookups works on iterables just like django does
agateblue opened this issue · comments
Considering the following structure:
users = [
'name': 'Kurt',
'tags': [
{'name': 'nice'},
{'name': 'friendly'},
]
]
It would be nice if nested lookups allowed us to run queries on the iterable objects, instead of the iterable itself, such as:
manager.filter(tags__name='nice')
# >>> return all users having at least a tag named 'nice'
EDIT:
Ideally, lookups on iterables would also be nestable:
companies = [
{
'name': 'blackbooks'
'employees': [
{
'name': 'Manny',
'tags': [
{'name': 'nice'},
{'name': 'friendly'},
]
}
]
},
{
'name': 'community'
'employees': [
{
'name': 'Britta',
'tags': [
{'name': 'activist'},
]
}
]
}
]
lifter.load(companies)
assert lifter.filter(employees__tags__name='friendly') == companies[0]