Skip to content

Commit

Permalink
handle method is prioritized
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkuty committed Jul 19, 2015
1 parent 6f60424 commit 4270c6d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions horizon_contrib/forms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,15 @@ def form_valid(self, form):
handled = None
success_url = self.get_success_url()

if hasattr(form, 'save'):
# handle is priotiry
if hasattr(form, 'handle'):

try:
handled = super(CreateView, self).form_valid(form)
except Exception as e:
raise e

elif hasattr(form, 'save'):

try:
instance = form.save()
Expand All @@ -213,13 +221,6 @@ def form_valid(self, form):
except:
pass

elif hasattr(form, 'handle'):

try:
handled = super(CreateView, self).form_valid(form)
except:
raise e

response = http.HttpResponseRedirect(success_url)
response['X-Horizon-Location'] = success_url

Expand Down

0 comments on commit 4270c6d

Please sign in to comment.