license data

remotes/origin/yandex
Bachurin Sergey 11 years ago
parent 2e74d18787
commit 3e590ace86
  1. 30
      project/customer/context_processors.py
  2. 1
      project/static/css/style.css
  3. 6
      project/templates/base.html

@ -5,10 +5,22 @@ from .models import License
def license_check_soon_ends(request):
print 12434674658457
try:
license_cookie = request.COOKIES.get('close_message_license')
license_15days = cache.get('license_15_%s' % (request.user.username,), None)
days_left = cache.get('days_left_%s' % (request.user.username,), None)
cur_license = cache.get('cur_license_%s' % (request.user.username,), None)
print cur_license
if not days_left or not cur_license:
now = datetime.today()
cur_license = License.objects.filter(company=request.user.profile, date_from__lte=now, date_to__gte=now, status__in=[-1, 1, 2], deleted=False)
if cur_license:
cur_license = cur_license[0]
print cur_license
days_left = (cur_license.date_to - now.date()).days
cache.set('days_left_%s' % (request.user.username,), days_left, 3600)
cache.set('cur_license_%s' % (request.user.username,), cur_license, 3600)
if not license_cookie:
now = datetime.today()
if license_15days is None:
@ -21,13 +33,11 @@ def license_check_soon_ends(request):
else:
license_15days = ''
print '@1!!!!!', license_15days
return {
'license_15days': license_15days,
'license_days': license_15days
}
print '!!!!!', license_15days
return {'license_days': license_15days}
except:
print 123123213
return {
'license_15days': license_15days,
'license_days': days_left,
'cur_license': cur_license,
}
except Exception as e:
print e
return { }

@ -621,3 +621,4 @@ a.popup-history {background:url(../img/popup-clock.png) no-repeat 3px center;}
a.popup-password {background:url(../img/popup-settings.png) no-repeat 3px center;}
a.popup-email {background:url(../img/popup-link.png) no-repeat 3px center;}
a.popup-unreg {background:url(../img/popup-trash.png) no-repeat 3px center;}
.italic {font-style: italic;}

@ -1,5 +1,5 @@
{# spaceless #}<!DOCTYPE html>
{% load cms_tags sekizai_tags menu_tags %}
{% load cms_tags sekizai_tags menu_tags pytils_numeral %}
{% url 'myauth_login' as myauth_login %}
{% url 'myauth_register' as myauth_register %}
@ -73,10 +73,10 @@
{% block content %}{% endblock %}
<div id="cabinet-popup">
<h2>Платежные данные</h2>
<div><span class='grey'>Тариф:</span><span class='italic'>{{ license.tariff }}</span></div>
<div><span class='grey'>Тариф:</span><span class='italic'>{% if cur_license.term > 0 %}{{ cur_license.term|get_plural:"месяц,месяца, месяцев" }}{% else %}пробный{% endif %}</span></div>
<div class='grey center'>Осталось</div>
<div class='center'>
<span class='yellow_round'>26{{ license_days }}</span>
<span class='yellow_round'>{{ license_days }}</span>
</div>
<a href='{% url "customer_order_license" %}' class='popup-link popup-buy-license'>Купить лицензию</a>
<a href='{% url "customer_bank_accounts_list" %}' class='popup-link popup-my-accs'>Мои счета</a>

Loading…
Cancel
Save