def has_management_permission(user):
"""
Replacing with ManagementPermissionMixin
used in def index (not as decorator)
used in def manage_territory
used in def add_master_list_select
used in def add_personal_list_select
used in def create_selection_widget
used in def delete_master_list_select
used in def delete_personal_list_select
used in def load_staff_category_selects
used in def load_staff_member_selects
used in def update_user_assignments
To be called by textdecorator @user_passes_test
Also, any time you need to check if user has management permissions
"""
if user.groups.filter(name='db_admin').exists():
return True
if user.groups.filter(name='management').exists():
return True
if user.is_superuser:
return True
return False
##################
# MAIN FUNCTIONS
##################
评论列表
文章目录