Merge branch 'dev' into 'master'

Dev

See merge request !62
master
Andrey 8 years ago
commit 48a7af8e29
  1. 1
      access/migrations/0002_init_group.py
  2. 9
      courses/api.py
  3. 4
      finance/views.py

@ -10,6 +10,7 @@ def init_group(*_args, **_kwargs):
Group.objects.get_or_create(name='students') Group.objects.get_or_create(name='students')
Group.objects.get_or_create(name='teachers') Group.objects.get_or_create(name='teachers')
Group.objects.get_or_create(name='managers') Group.objects.get_or_create(name='managers')
Group.objects.get_or_create(name='finance_managers')
Group.objects.get_or_create(name='lead_managers') Group.objects.get_or_create(name='lead_managers')
Group.objects.get_or_create(name='curators') Group.objects.get_or_create(name='curators')
Group.objects.get_or_create(name='partners') Group.objects.get_or_create(name='partners')

@ -48,3 +48,12 @@ class CourseProgressApi:
include_lesson = True include_lesson = True
return acc return acc
class CourseParamsApi:
def __init__(self, token):
self.course = Course.objects.get(token=token)
def get_slug_and_title(self):
return {"title": self.course.title, "slug": self.course.slug}

@ -12,6 +12,7 @@ from rest_framework.views import APIView
from yandex_money.models import Payment from yandex_money.models import Payment
from django.conf import settings from django.conf import settings
from courses.api import CourseParamsApi
from finance.models import Bill, Invoice from finance.models import Bill, Invoice
from finance.serializers import BillSerializer, InvoiceSerializer from finance.serializers import BillSerializer, InvoiceSerializer
from lms.global_decorators import transaction_decorator from lms.global_decorators import transaction_decorator
@ -178,11 +179,12 @@ def get_invoices(request):
writer.writerow(['date', 'student_email', 'full_name', 'course', 'price', 'real_price', 'key']) writer.writerow(['date', 'student_email', 'full_name', 'course', 'price', 'real_price', 'key'])
for i in invoices.order_by('-date'): for i in invoices.order_by('-date'):
course_api = CourseParamsApi(i.bill.course_token)
writer.writerow([ writer.writerow([
i.date, i.date,
i.bill.user.email, i.bill.user.email,
i.bill.user.get_full_name(), i.bill.user.get_full_name(),
i.bill.course.title, course_api.get_slug_and_title()['title'],
i.price, i.price,
i.real_price, i.real_price,
i.key, i.key,

Loading…
Cancel
Save