balance.py 926 B

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