reviewboard.search.forms¶
Forms for searching Review Board.
- class RBSearchForm(user=None, local_site=None, **kwargs)[source]¶
Bases:
ModelSearchForm
The Review Board search form.
This form is capable of searching for
ReviewRequests
andUsers
.- FILTER_TYPES = {'': {'models': [<class 'reviewboard.reviews.models.review_request.ReviewRequest'>, <class 'django.contrib.auth.models.User'>], 'name': 'All results'}, 'reviewrequests': {'models': [<class 'reviewboard.reviews.models.review_request.ReviewRequest'>], 'name': 'Review Requests'}, 'users': {'models': [<class 'django.contrib.auth.models.User'>], 'name': 'Users'}}[source]¶
Available model filters.
- __init__(user=None, local_site=None, **kwargs)[source]¶
Initialize the search form.
- Parameters:
user (
django.contrib.auth.models.User
) –The user performing the search.
Results will be limited to those visible to the user.
local_site (
reviewboard.site.models.LocalSite
) –The Local Site the search is being performed on.
Results will be limited to those on the LocalSite.
**kwargs (
dict
) – Additional keyword arguments to forward to the parent form.
- clean_q()[source]¶
Clean the
q
field.The field will be stripped of leading and trailing whitespace.
- Returns:
The stripped query.
- Return type:
- clean_model_filter()[source]¶
Clean the
model_filter
field.If no filter is provided, the default (all models) will be used.
- search()[source]¶
Perform a search.
- Returns:
The search results.
- Return type:
haystack.query.SearchQuerySet
- __annotations__ = {}¶
- declared_fields = {'id': <django.forms.fields.IntegerField object>, 'model_filter': <django.forms.fields.MultipleChoiceField object>, 'q': <django.forms.fields.CharField object>}¶