-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement __contains, __contained_by, __overlap and __len for ArrayField #1877
base: develop
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #1877 will not alter performanceComparing Summary
|
The psycopg tests are failing with
because psycopg is trying to use the smallest type possible... I need to think how to overcome this. |
1169390
to
f197ea4
Compare
Fixed! |
Pull Request Test Coverage Report for Build 13293264948Details
💛 - Coveralls |
return get_backward_fk_filters(field_name, field) | ||
if isinstance(field, JSONField): | ||
return get_json_filter(field_name, source_field) | ||
if field: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that if field is not None
is better.
Description
Implements the following lookup types for
ArrayField
:contains
-await ArrayFields.filter(array__contains=[1, 2, 3]).first()
which will use the@>
operatorcontained_by
- will use the<@
operatoroverlap
- will use the&&
operatorlen
- will use thearray_length
function, e.g.await ArrayFields.filter(array__len=3).first()
Motivation and Context
This should close #1857 and #370.
The filters are modeled after Django's counterparts.
How Has This Been Tested?
make ci
Checklist: