redirect - Different ways for sending request context with HttpResponseRedirect in django -


i have django app , implemented payment gateway functionality. trying

after successful transation, need redirect user page shows response details using httpresponseredirect redirect page, have variable response in view contains reponse details, need send variable context redirecting url renders template, can use response variable display results.

so above functionality, got 3 methods

  1. sending variable query parameter(which not safe in method because sensitive credit card transaction details)
  2. using session framework, not working in case, code below
  3. django messaging framework(which not useful in case)

views.py

def payment(request):     amount = 1     if request.method == 'post':         form = creditcardform(request.post)         if form.is_valid():             data = form.cleaned_data             ...........             ...........              response = stripe.payment_purchase(amount,data)              request.session['response'] = response             return httpresponseredirect(reverse('paygate:payment_success'))     else:         form = creditcardform(initial={'number':'4242424242424242'})     return render_to_response('payment/stripe_payment_form.html',{'form': form,                                              'response':response,},                                              context_instance=requestcontext(request)) 

payment_success url view

class paymentsuccess(templateview):     template_name = 'payment/payment_success.html' 

i tried access response variable in template, displaying nothing

payment_success.html

{% extends "base.html" %} {% block main_title %}payment{% endblock %} {% block title %}success{% endblock %}  {% block content %}   <h1>response details</h1>   <p>your status <span>{{ request.session.response }}</span></p> {% endblock %}  

so can please let me know various different safe , secure ways send context variables(in case credit card payment details) redirecting url using httpresponseredirect method

i think there 4. possible item in list, suggest use.

the safest , pragmatic way of accomplish want have successful view showing actual results stored in database.

the idea behind is:

payment view action user performs on database.

payment_success view way of telling user action performed , the input user desired.

likewise, best way of showing action correct show result on database, i.e. stored on database regarding action.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -