def balance_remaining(request):
    order = None
    orderid = request.session.get('orderID')
    if orderid:
        try:
            order = Order.objects.get(pk=orderid)
        except Order.DoesNotExist:
            # TODO: verify user against current user
            pass
            
    if not order:
        url = urlresolvers.reverse('satchmo_checkout-step1')
        return HttpResponseRedirect(url)

    if request.method == "POST":
        new_data = request.POST.copy()
        form = PaymentMethodForm(data=new_data, order=order)
        if form.is_valid():
            data = form.cleaned_data
            modulename = data['paymentmethod']
            if not modulename.startswith('PAYMENT_'):
                modulename = 'PAYMENT_' + modulename
            
            paymentmodule = config_get_group(modulename)
            url = lookup_url(paymentmodule, 'satchmo_checkout-step2')
            return HttpResponseRedirect(url)
        
    else:
        form = PaymentMethodForm(order=order)
        
    ctx = RequestContext(request, {'form' : form, 
        'order' : order,
        'paymentmethod_ct': len(active_gateways())
    })
    return render_to_response('shop/checkout/balance_remaining.html',
                              context_instance=ctx)
Fetch instance from the datastore of a specific Model type using key.
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/payment/views/balance.py/balance_remaining--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/ext/db/__init__.py/Model.get