djblets.webapi.resources.mixins.queries¶
Mixins for helping with lookups from HTTP GET query strings.
- class APIQueryUtilsMixin¶
Bases:
object
Adds useful functions to a WebAPIResource for database lookups.
- build_queries_for_int_field(request, field_name, query_param_name=None)¶
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 thefield_name
.
- Returns:
A query expression that can be used in database queries.
- Return type: