Merge pull request #49 from pyohio/pyohio-sponsorship-redirect

Redirect to dashboard if there are no benefits to edit.
This commit is contained in:
Patrick Altman 2014-07-31 23:37:34 -05:00
commit c17a4cbda1

View file

@ -16,7 +16,16 @@ def sponsor_apply(request):
form = SponsorApplicationForm(request.POST, user=request.user)
if form.is_valid():
sponsor = form.save()
if sponsor.sponsor_benefits.all():
# Redirect user to sponsor_detail to give extra information.
messages.success(request, "Thank you for your sponsorship "
"application. Please update your "
"benefit details below.")
return redirect("sponsor_detail", pk=sponsor.pk)
else:
messages.success(request, "Thank you for your sponsorship "
"application.")
return redirect("dashboard")
else:
form = SponsorApplicationForm(user=request.user)