Hi there, I've looked through the django documentation, done lots of googling and have tried quite a few different solutions but to no avail.
I've created a 3 part form using Django's FormWizard. Once the last form (a payment form) is validated, I send a payment request to a payment gateway.
I'm doing the payment processing in the 'process_step' method of the FormWizard.
I'm having difficulty figuring out how to have the FormWizard show the payment page again when the payment fails. As it is now, the FormWizard's 'done' method gets called (after I've done my processing in process_step), as all of the forms have been validated.
I'm wondering if I need to override the call method. Not really sure how to do that, but I'm currently trying to figure that out.
Any help would be much appreciated. Regards, Shawn
class TrainingWizard(FormWizard):
def process_step(self,request,form,step):
if step == 0:
self.extra_context = {'stepOne': "One"}
if step == 1:
self.extra_context = {'stepTwo': "Two"}
if step == 2:
if self.get_response != "Success":
#Payment Failed
#Add error message
#Show Payment Form Again to allow user to retry
return
def get_response(self):
#return "Success"
return "Declined"
def done(self, request, form_list):
return HttpResponseRedirect('/training-registration-complete/')