balance.py 973 B

1234567891011121314151617181920212223242526
  1. from django.shortcuts import render
  2. from django.contrib.auth.decorators import login_required
  3. from SharixAdmin.views.context import get_context
  4. from django.utils.translation import gettext as _
  5. @login_required
  6. def balance(request):
  7. context = get_context(request, {
  8. 'title':_('Top up your balance')
  9. })
  10. if request.method == 'POST':
  11. if float(request.POST['price']) > 0:
  12. context = get_context(request, {
  13. 'title':_('Top up your balance'),
  14. 'msg':_('The payment was successful ;)')
  15. })
  16. return render(request, "SharixAdmin/balance_success.html", context)
  17. else:
  18. context = get_context(request, {
  19. 'title':_('Top up your balance'),
  20. 'msg':_('Payment failed ;(')
  21. })
  22. return render(request, "SharixAdmin/balance_success.html", context)
  23. return render(request, "SharixAdmin/balance.html", context)