Queries¶
-
class
ajaxviews.queries.AjaxQuerySet(model=None, query=None, using=None, hints=None)[source]¶ Bases:
django.db.models.query.QuerySetThis QuerySet enhances generic filter options that work together with server side
ajaxviews.views.AjaxListViewand client sideFilterView. You can instantiate the QuerySet as manager to your models to enable default filtering.- Filter and sorting options passed through
json_cfgand applied tofilter_fields: sort_indexList index of field to sort by.sort_orderOrder fields by asc, desc or none.filter_indexList index of field to filter results. This displays all possible filter options.selected_filter_indexField of filter to apply on queryset.selected_filter_valuesValues to filter by on selected field.
Variables: distinct_qs (bool) – Apply distinct filter option. Default is True. -
default_filter(opts, *args, **kwargs)[source]¶ This is called by the view’s
get_querysetmethod.It calls the
ajax_filter()first to apply the filter and thenajax_sort()to sort the filtered QuerySet. Each of these methods can be overridden to manipulate the QuerySet.Parameters: - opts – Filter options passed through request.
- args – Positional filter options in addition to opts.
- kwargs – Keword filter options in addition to opts.
Returns: Filtered QuerySet
- Filter and sorting options passed through