You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.1 KiB

# coding=utf-8
from django.http import Http404
from lms.decors import response_decor
from courses.models import Course
from finance.models import Price, Bill
@response_decor(template='traffic_map.html')
def traffic_map(request, course):
# Страница цен
_course = Course.objects.get(id=course)
return {'course': _course.title, 'traffic': Price.objects.filter(course=_course)}
@response_decor(template='selfbill.html', without_auth=True)
def self_bill(request, key):
# Страница формирования собственного счета
try:
req = Price.objects.get(key=key)
except Price.DoesNotExist:
raise Http404
else:
return {'sum': req.cost, 'name': req.get_name(), 'key': key}
@response_decor(template='bill_out.html', without_auth=True)
def bill_out(request, salt):
try:
bill = Bill.objects.get(salt=salt)
except Bill.DoesNotExist:
raise Http404
else:
if bill.status == 'W':
bill.status = 'P'
bill.save()
return {'data': bill.gen_yandex_data(), 'price': bill.price}