From 4acf87733a7bc0eb23ec3ee217899bbf752c5eaf Mon Sep 17 00:00:00 2001 From: nathaniel smith Date: Mon, 19 Dec 2016 22:52:17 -0800 Subject: [PATCH] fix throttle bug throttling was checked before other errors, meaning you got throttled without actually saving anything --- ttadmin/guestbook/forms.py | 4 ++-- ttadmin/help/forms.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ttadmin/guestbook/forms.py b/ttadmin/guestbook/forms.py index 2be32c6..d23dd04 100644 --- a/ttadmin/guestbook/forms.py +++ b/ttadmin/guestbook/forms.py @@ -39,9 +39,9 @@ class GuestbookForm(Form): def clean(self): result = super().clean() - throttle_submission(result['name']) - if self.errors: raise ValidationError('oops, looks like there were some problems below.') + throttle_submission(result['name']) + return result diff --git a/ttadmin/help/forms.py b/ttadmin/help/forms.py index 760f7a5..1ae2bcc 100644 --- a/ttadmin/help/forms.py +++ b/ttadmin/help/forms.py @@ -51,9 +51,9 @@ class TicketForm(Form): def clean(self): result = super().clean() - throttle_submission(result['email']) - if self.errors: raise ValidationError('oops, looks like there were some problems below.') + throttle_submission(result['email']) + return result