url_filter.backends.sqlalchemy module¶
-
class
url_filter.backends.sqlalchemy.
SQLAlchemyFilterBackend
(*args, **kwargs)[source]¶ Bases:
url_filter.backends.base.BaseFilterBackend
Filter backend for filtering SQLAlchemy query objects.
Warning
The filter backend can ONLY filter SQLAlchemy’s query objects. Passing any other datatype for filtering will kill happy bunnies under rainbow.
Warning
The filter backend can ONLY filter query objects which query a single entity (e.g. query a single model or model column). If query object queries multiple entities,
AssertionError
will be raised.-
build_clause
(spec)[source]¶ Construct SQLAlchemy binary expression filter clause from the given filter specification.
Parameters: spec (FilterSpec) – Filter specification for which to construct filter clause Returns: Tuple of filter binary expression clause and and a list of model attributes/descriptors which should be joined when doing filtering. If these attributes are not joined, SQLAlchemy will not join appropriate tables hence wont be able to correctly filter data. Return type: tuple
-
filter_by_specs
(queryset)[source]¶ Filter SQLAlchemy query object by applying all filter specifications
The filtering is done by calling
filter
with all appropriate filter clauses. Additionally if any filter specifications filter by related models, those models are joined as necessary.
-
name
= u'sqlalchemy'¶
-
supported_lookups
= set([u'startswith', u'gt', u'gte', u'contains', u'lt', u'iendswith', u'icontains', u'iexact', u'isnull', u'range', u'istartswith', u'lte', u'in', u'endswith', u'iin', u'exact'])¶
-