changeset 957:76ee6403e033

Merge with main line.
author Brian Neal <bgneal@gmail.com>
date Wed, 03 Jun 2015 21:13:43 -0500 (2015-06-04)
parents 71a671dab55d (current diff) 6cc9221d04a7 (diff)
children e09a2a536f92
files
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/custom_search/forms.py	Wed Jun 03 21:13:08 2015 -0500
+++ b/custom_search/forms.py	Wed Jun 03 21:13:43 2015 -0500
@@ -54,13 +54,17 @@
                 label='Search in', widget=forms.CheckboxSelectMultiple)
 
     def clean(self):
+        super(CustomModelSearchForm, self).clean()
         if not settings.SEARCH_QUEUE_ENABLED:
             raise forms.ValidationError("Our search function is offline for "
                     "maintenance. Please try again later. "
                     "We apologize for any inconvenience.")
 
-        if not (self.cleaned_data['q'] or self.cleaned_data['exact'] or
-                self.cleaned_data['exclude']):
+        q = self.cleaned_data.get('q')
+        exact = self.cleaned_data.get('exact')
+        exclude = self.cleaned_data.get('exclude')
+
+        if not (q or exact or exclude):
             raise forms.ValidationError('Please supply some search terms')
 
         return self.cleaned_data