Skip to content

Commit

Permalink
Merge pull request #2873 from jgmize/max-query-length
Browse files Browse the repository at this point in the history
Add max_length param to search forms: bug 1286313
  • Loading branch information
glogiotatidis authored Jul 13, 2016
2 parents 2ad2f0f + ad0b1c4 commit 27b8136
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kitsune/search/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
from kitsune.wiki.config import CATEGORIES


MAX_QUERY_LENGTH = 200
SEARCH_LANGUAGES = [(k, LOCALES[k].native) for
k in settings.SUMO_LANGUAGES]


class SimpleSearchForm(forms.Form):
"""Django form to handle the simple search case."""
q = forms.CharField(required=True)
q = forms.CharField(required=True, max_length=MAX_QUERY_LENGTH)

w = forms.TypedChoiceField(required=False, coerce=int,
widget=forms.HiddenInput,
Expand Down Expand Up @@ -71,7 +72,7 @@ def clean_products(self):
class AdvancedSearchForm(forms.Form):
"""Django form for handling display and validation"""
# Common fields
q = forms.CharField(required=False)
q = forms.CharField(required=False, max_length=MAX_QUERY_LENGTH)

w = forms.TypedChoiceField(required=False, coerce=int,
widget=forms.HiddenInput,
Expand Down

0 comments on commit 27b8136

Please sign in to comment.