Added redirection instead of rendering a template for unsuccessful order submission. Also added base_url context parameter to order notification email template
This commit is contained in:
parent
b54b46c08b
commit
949f47d124
1 changed files with 4 additions and 3 deletions
|
@ -61,18 +61,19 @@ class PricingView(TemplateView):
|
||||||
name = name_field.clean(name)
|
name = name_field.clean(name)
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
messages.add_message(self.request, messages.ERROR, '%(value) is not a proper name.'.format(name))
|
messages.add_message(self.request, messages.ERROR, '%(value) is not a proper name.'.format(name))
|
||||||
return reverse('datacenterlight:order')
|
return HttpResponseRedirect(reverse('datacenterlight:pricing'))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
email = email_field.clean(email)
|
email = email_field.clean(email)
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
messages.add_message(self.request, messages.ERROR, '%(value) is not a proper email.'.format(email))
|
messages.add_message(self.request, messages.ERROR, '%(value) is not a proper email.'.format(email))
|
||||||
return reverse('datacenterlight:order')
|
return HttpResponseRedirect(reverse('datacenterlight:pricing'))
|
||||||
|
|
||||||
# We have valid email and name of the customer, hence send an
|
# We have valid email and name of the customer, hence send an
|
||||||
# email to the admin
|
# email to the admin
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
|
'base_url': "{0}://{1}".format(self.request.scheme, self.request.get_host()),
|
||||||
'name': name,
|
'name': name,
|
||||||
'email': email,
|
'email': email,
|
||||||
'cores': cores,
|
'cores': cores,
|
||||||
|
@ -91,7 +92,7 @@ class PricingView(TemplateView):
|
||||||
email = BaseEmail(**email_data)
|
email = BaseEmail(**email_data)
|
||||||
email.send()
|
email.send()
|
||||||
|
|
||||||
return render(self.request, 'datacenterlight/success.html', {})
|
return HttpResponseRedirect(reverse('datacenterlight:order_success'))
|
||||||
|
|
||||||
|
|
||||||
class BetaAccessView(FormView):
|
class BetaAccessView(FormView):
|
||||||
|
|
Loading…
Reference in a new issue