You can add the decorator in
or
decorate the
urls.py
, e.g., login_required(ViewSpaceIndex.as_view(..))
or
decorate the
dispatch
method with method_decorator
e.g.,from django.utils.decorators import method_decorator
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(ViewSpaceIndex, self).dispatch(*args, **kwargs)
or
@method_decorator(check_user_allowed(
allowed_user_types_list=[SUPER_ADMIN_KEY, ADMIN_KEY],
need_org_check=True))
def get(self, request, organization_id):
form = MapLicensesForm(request.user, organization_id)
params = {}
params['form'] = form
params['current_organization_id'] = organization_id
#params['license_types'] = [val[0] for index, val in enumerate(filter(lambda x: x[0] != 'AppServer', get_license_type_choices()))]
params['lic_types_obj'] = get_license_type_choices_obj()
params['template_params'] = TemplateParams(organization_id)
return render(request, 'iadmin/map_license.html', params)
No comments:
Post a Comment