Comments (3)
Hello and sorry for my late answer, I was actually in a vacation trip :)
You can indeed use in, but with the myfield__value_in
lookup:
objects.filter(eye_color__value_in=['brown'])
The fact is Python does not allows to override the __contains__
to return a non-boolean value. This is quite strange, considering you can do this for other lookups such as __eq__
.
If you want to combine queries, you can also use the value_in
operator object directly:
sent_folders = ['folder1', 'folder2']
query = Message.folder.test(lifter.lookups.value_in(sent_folders))
Also, as in
is a registered keyword in python, for internal reasons, so that's why the lookup is named value_in
instead of simply in
.
The API is really not great here sorry :/
from lifter.
Thank you!
I am thinking how to add this information improved with extra expressions like contains etc to the docs. Could you please keep this issue open meanwhile?
from lifter.
Sure, that would be a great addition. Feel free to provide a PR whenever you have the time :)
from lifter.
Related Issues (20)
- Use of __getattr__ in QuerySet HOT 2
- TinyDB query api / Should we change the query API ? HOT 7
- Pandas compatibility HOT 2
- Setup a real documentation HOT 3
- JSON list as Python generator? HOT 4
- Optimize query matching when chaining filters HOT 4
- Allow querying on field that do not exist on all models HOT 2
- Create a soft-failing mode when querying fields that do not exist
- Allow sorting by multiple fields at once
- Create a benchmark suite for easy comparison of lifter versus python code performance
- Make lifter able to query any kind of data (LINQ) HOT 1
- Documentation example broken (AttributeError: 'module' object has no attribute 'models') HOT 1
- Any plans to support querystrings / Allow queries to be serialized from other formats HOT 5
- Store lookups (gte, gt, eq, etc.) in a dedicated registry
- Implement a caching mechanism HOT 1
- Add a simple django contrib app to allow locally filtering querysets
- Missing backends module in 0.4 HOT 1
- Less complexity for the Store - > Refined Store -> Manager stack ?
- Is it possible to parse the query from a string? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lifter.