|
|
|
|
@ -10,6 +10,7 @@ from django.contrib.auth.decorators import login_required |
|
|
|
|
from django.template.response import TemplateResponse |
|
|
|
|
from django.core.urlresolvers import reverse |
|
|
|
|
from django.views.decorators.csrf import csrf_protect |
|
|
|
|
from django.db.models import Q |
|
|
|
|
from django.conf import settings |
|
|
|
|
|
|
|
|
|
from yandex_money.models import Payment |
|
|
|
|
@ -111,17 +112,13 @@ def paid_list(request): |
|
|
|
|
|
|
|
|
|
template_name = 'customer/profile/paid_list.html' |
|
|
|
|
|
|
|
|
|
licenses = License.objects.filter( |
|
|
|
|
company=request.user.profile, |
|
|
|
|
status__in = [ |
|
|
|
|
consts.LICENSE_TEST_PERIOD, |
|
|
|
|
consts.LICENSE_PAID, |
|
|
|
|
consts.LICENSE_ACTIVE, |
|
|
|
|
consts.LICENSE_EXPIRED, |
|
|
|
|
consts.LICENSE_SUSPENDED, |
|
|
|
|
], |
|
|
|
|
deleted=False |
|
|
|
|
).order_by('-id') |
|
|
|
|
# TODO почему в оплаченных лицензиях выводится пробный период и замороженные? |
|
|
|
|
licenses = (License.objects |
|
|
|
|
.filter(company=request.user.profile, deleted=False) |
|
|
|
|
.filter(Q(status__in = [consts.LICENSE_TEST_PERIOD, consts.LICENSE_ACTIVE, consts.LICENSE_EXPIRED]) | |
|
|
|
|
Q(order_status__in=[consts.ORDER_PAID, consts.ORDER_SUSPENDED])) |
|
|
|
|
.order_by('-id') |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
return render(request, template_name, {'licenses': licenses}) |
|
|
|
|
|
|
|
|
|
@ -134,7 +131,8 @@ def delete_license(request, pk): |
|
|
|
|
raise_if_no_profile(request) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
license = License.objects.get(pk=pk, status=consts.LICENSE_UNPAID, company=request.user.profile) |
|
|
|
|
license = License.objects.get(pk=pk, company=request.user.profile, |
|
|
|
|
order_status=consts.ORDER_UNPAID, payform__gt=consts.PAYFORM_FREE) |
|
|
|
|
if request.method == 'POST': |
|
|
|
|
license.deleted = True |
|
|
|
|
license.save() |
|
|
|
|
|