Merge branch 'current_branch' into 'dev'

migrate update

See merge request !61
feature/fix_generate_pass
Andrey 8 years ago
commit 5103bc5c47
  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='teachers')
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='curators')
Group.objects.get_or_create(name='partners')

@ -48,3 +48,12 @@ class CourseProgressApi:
include_lesson = True
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 django.conf import settings
from courses.api import CourseParamsApi
from finance.models import Bill, Invoice
from finance.serializers import BillSerializer, InvoiceSerializer
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'])
for i in invoices.order_by('-date'):
course_api = CourseParamsApi(i.bill.course_token)
writer.writerow([
i.date,
i.bill.user.email,
i.bill.user.get_full_name(),
i.bill.course.title,
course_api.get_slug_and_title()['title'],
i.price,
i.real_price,
i.key,

Loading…
Cancel
Save