I have a search view on my application build on django-haystack. It works fine.
from haystack.forms import SearchForm
from haystack.query import SearchQuerySet
from haystack.views import SearchView
class SearchView(SearchView):
sqs = SearchQuerySet().filter(lang=get_language())
template = "search/search.html"
searchqueryset = sqs
results_per_page=10
form_class=SearchForm
I want to add a custom validation to this view to set minimum input value. What is the most appropriate way to do that?
Thanks.
Validation is a part of form behavior, so you need to create successor of SearchForm and add custom validation there. There is example in docs.