Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def buy_course(request, cid):
- cid_course = get_object_or_404(Course, id=cid)
- profile = Profile.objects.get(user=request.user)
- parent_form = ParentFormFirstBuy(request.POST)
- student_form = StudentFormFirstBuy(request.POST)
- action = request.POST.get('action')
- # выбор кто оплачивает : родитель или ученик
- if request.POST and action == 'Купити 1 місяць (успіх)':
- # success logic
- # message
- messages.success(request, 'Вітаємо! Ви успішно оплатили 1 місяць навчання!')
- if request.POST and action == 'Купити 1 місяць (поразка)':
- # message
- messages.warning(request, 'Щось пішло не так, спробуйте ще раз!')
- context = {
- 'course': cid_course,
- 'parent_form': parent_form,
- 'student_form': student_form,
- }
- return render(request, 'course/buy_course.html', context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement