conditionally check honeypot errors, closes #346
authorBryan <btbonval@gmail.com>
Wed, 26 Feb 2014 01:57:20 +0000 (20:57 -0500)
committerBryan <btbonval@gmail.com>
Wed, 26 Feb 2014 01:57:20 +0000 (20:57 -0500)
karmaworld/apps/courses/views.py

index 332bd7c6fef3dcdbf64626f267d8eeebcc7f4725..acf38ed24077106e5e0c625a6503607472db1bf1 100644 (file)
@@ -69,7 +69,8 @@ class CourseListView(ListView, ModelFormMixin, ProcessFormView):
         # hard code errors for the dynamically named honeypot field.
         # This bit will not be necessary when the form is dynamically
         # generated by Django rather than hard coded in the template.
-        kwargs['honeypot_errors'] = [x for x in form.errors['honeypot']]
+        kwargs['honeypot_errors'] = [x for x in form.errors['honeypot']] if
+            'honeypot' in form.errors else []
         return self.render_to_response(self.get_context_data(**kwargs))