djblets.webapi.resources.mixins.queries¶
Mixins for helping with lookups from HTTP GET query strings.
- class APIQueryUtilsMixin[source]¶
Adds useful functions to a WebAPIResource for database lookups.
- build_queries_for_int_field(request, field_name, query_param_name=None)[source]¶
Build queries based on request parameters for an int field.
get_queryset()
implementations can use this to allow callers to filter results through range matches. Callers can search for exact matches, or can make use of the following operations:<
(?name-lt=value
)<=
(?name-lte=value
)>
(?name-gt=value
)>=
(?name-gte=value
)
- Parameters
request (django.http.HttpRequest) – The HTTP request from the client.
field_name (unicode) – The field name in the database to query against.
query_param_name (unicode) – The query argument passed to the URL. Defaults to the
field_name
.
- Returns
A query expression that can be used in database queries.
- Return type