Skip to content

Commit

Permalink
Added FacetedSearchForm to make handling facets easier.
Browse files Browse the repository at this point in the history
  • Loading branch information
toastdriven committed May 9, 2009
1 parent 3385ba3 commit a9708f4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions haystack/forms.py
Expand Up @@ -38,6 +38,18 @@ def search(self):
return super(HighlightedSearchForm, self).search().highlight()


class FacetedSearchForm(SearchForm):
selected_facets = forms.CharField(required=False, widget=forms.HiddenInput)

def search(self):
sqs = super(FacetedSearchForm, self).search()

if self.cleaned_data['selected_facets']:
sqs = sqs.narrow(self.cleaned_data['selected_facets'])

return sqs


class ModelSearchForm(SearchForm):
def __init__(self, *args, **kwargs):
super(ModelSearchForm, self).__init__(*args, **kwargs)
Expand Down

0 comments on commit a9708f4

Please sign in to comment.