Here are the examples of the python api django.forms.SearchForm taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
3
Example 1
Project: wikicoding Source File: article.py
def dispatch(self, request, *args, **kwargs):
# Do not allow anonymous users to search if they cannot read content
if request.user.is_anonymous() and not settings.ANONYMOUS:
return redirect(settings.LOGIN_URL)
self.search_form = forms.SearchForm(request.GET)
if self.search_form.is_valid():
self.query = self.search_form.cleaned_data['q']
else:
self.query = None
return super(SearchView, self).dispatch(request, *args, **kwargs)