@register.assignment_tag(takes_context=True)
def filer_has_permission(context, item, action):
 permission_method_name = u'has_{action}_permission'.format(action=action)
 permission_method = getattr(item, permission_method_name, None)
 request = context.get(u'request')
 if ((not permission_method) or (not request)):
  return False
 return permission_method(request)

@ register . assignment_tag ( takes_context = True ) def filer_has_permission ( context , item , action ) : permission_method_name = u'has_{action}_permission' . format ( action = action ) permission_method = getattr ( item , permission_method_name , None ) request = context . get ( u'request' ) if ( ( not permission_method ) or ( not request ) ) : return False return permission_method ( request )
does the current user have permission to do the given action on the given item .