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.
16 lines
542 B
16 lines
542 B
# -*- coding: utf-8 -*-
|
|
from django.contrib.auth.decorators import user_passes_test
|
|
from django.core.urlresolvers import reverse
|
|
|
|
def license_required(function=None, redirect_field_name=None, login_url='/my/license/'):
|
|
"""
|
|
Проверка активности лицензии
|
|
"""
|
|
actual_decorator = user_passes_test(
|
|
lambda u: u.profile.active,
|
|
login_url=login_url,
|
|
redirect_field_name=redirect_field_name
|
|
)
|
|
if function:
|
|
return actual_decorator(function)
|
|
return actual_decorator
|
|
|