Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2021
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. def buy_course(request, cid):
  2. cid_course = get_object_or_404(Course, id=cid)
  3. profile = Profile.objects.get(user=request.user)
  4.  
  5. parent_form = ParentFormFirstBuy(request.POST)
  6. student_form = StudentFormFirstBuy(request.POST)
  7.  
  8. action = request.POST.get('action')
  9. # выбор кто оплачивает : родитель или ученик
  10. if request.POST and action == 'Купити 1 місяць (успіх)':
  11. # success logic
  12.  
  13. # message
  14. messages.success(request, 'Вітаємо! Ви успішно оплатили 1 місяць навчання!')
  15. if request.POST and action == 'Купити 1 місяць (поразка)':
  16. # message
  17. messages.warning(request, 'Щось пішло не так, спробуйте ще раз!')
  18.  
  19. context = {
  20. 'course': cid_course,
  21. 'parent_form': parent_form,
  22. 'student_form': student_form,
  23. }
  24. return render(request, 'course/buy_course.html', context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement