comparison custom_search/forms.py @ 1127:829d3b7fc0f7

Convert search page to V3 design.
author Brian Neal <bgneal@gmail.com>
date Tue, 13 Sep 2016 21:49:22 -0500
parents 2f36abf65a62
children
comparison
equal deleted inserted replaced
1126:575f10fc4060 1127:829d3b7fc0f7
36 This form can optionally receive the user making the search as a keyword 36 This form can optionally receive the user making the search as a keyword
37 argument ('user') to __init__. This will be used for logging search queries. 37 argument ('user') to __init__. This will be used for logging search queries.
38 38
39 """ 39 """
40 q = forms.CharField(required=False, label='All these words', 40 q = forms.CharField(required=False, label='All these words',
41 widget=forms.TextInput(attrs={'type': 'search', 'class': 'search', 41 widget=forms.TextInput(attrs={'type': 'search'}))
42 'size': 48}))
43 exact = forms.CharField(required=False, label='This exact word or phrase', 42 exact = forms.CharField(required=False, label='This exact word or phrase',
44 widget=forms.TextInput(attrs={'type': 'search', 'class': 'search', 43 widget=forms.TextInput(attrs={'type': 'search'}))
45 'size': 48}))
46 exclude = forms.CharField(required=False, label='None of these words', 44 exclude = forms.CharField(required=False, label='None of these words',
47 widget=forms.TextInput(attrs={'type': 'search', 'class': 'search', 45 widget=forms.TextInput(attrs={'type': 'search'}))
48 'size': 48}))
49 46
50 def __init__(self, *args, **kwargs): 47 def __init__(self, *args, **kwargs):
51 self.user = kwargs.pop('user', None) 48 self.user = kwargs.pop('user', None)
52 super(CustomModelSearchForm, self).__init__(*args, **kwargs) 49 super(CustomModelSearchForm, self).__init__(*args, **kwargs)
53 self.fields['models'] = forms.MultipleChoiceField(choices=MODEL_CHOICES, 50 self.fields['models'] = forms.MultipleChoiceField(choices=MODEL_CHOICES,