def filter_queryset(self, request, queryset, view): user_level_projects = Authorization.get_user_level_projects_ids( request.user) if request.query_params.get('accessible'): for i, c in enumerate(queryset): if (c.access_level_pub_feature.rank > user_level_projects[c.slug]): queryset = queryset.exclude(slug=c.slug) return queryset
def filter_queryset(self, request, queryset, view): user_level_projects = Authorization.get_user_level_projects_ids( request.user) user_access_level = request.query_params.get('user_access_level') if user_access_level: requested_user_access_level_projects = dict( (k, v) for k, v in user_level_projects.items() if v == int(user_access_level)) queryset = queryset.filter( slug__in=requested_user_access_level_projects.keys()) return queryset