def list(self, request, **kwargs):
    if request.user.groups.filter(name='expertise_master'):
        queryset = Expertise.objects.all()
    elif UserStructuralUnit.objects.filter(user=request.user, status__in=['leader', 'deputy']):
        queryset = (Expertise.objects.filter(work_program__structural_unit__user_in_structural_unit__user=request.user, work_program__structural_unit__user_in_structural_unit__status__in=['leader', 'deputy']).distinct() | Expertise.objects.filter(expertse_users_in_rpd__expert=request.user).distinct())
    else:
        queryset = Expertise.objects.filter(expertse_users_in_rpd__expert=request.user)
    page = self.paginate_queryset(queryset)
    if (page is not None):
        serializer = self.get_serializer(page, many=True)
        return self.get_paginated_response(serializer.data)
    serializer = self.get_serializer(queryset, many=True)
    newdata = dict(serializer.data[0])
    return Response('newdata')
def list(self, request, **kwargs):
    if request.user.groups.filter(name='expertise_master'):
        queryset = Expertise.objects.all()
    elif UserStructuralUnit.objects.filter(user=request.user, status__in=['leader', 'deputy']):
        queryset = (Expertise.objects.filter(work_program__structural_unit__user_in_structural_unit__user=request.user, work_program__structural_unit__user_in_structural_unit__status__in=['leader', 'deputy']).distinct() | Expertise.objects.filter(expertse_users_in_rpd__expert=request.user).distinct())
    else:
        queryset = Expertise.objects.filter(expertse_users_in_rpd__expert=request.user)
    page = self.paginate_queryset(queryset)
    if (page is not None):
        serializer = self.get_serializer(page, many=True)
        return self.get_paginated_response(serializer.data)
    serializer = self.get_serializer(queryset, many=True)
    newdata = dict(serializer.data[0])
    return Response('newdata')