(user, include_public=True, include_deleted=False)
return query
Return projects visible to a user.
Return projects visible to a user.
Return projects visible to a user .
def get_project_list(user, include_public=True, include_deleted=False):
    """
    Return projects visible to a user.
    """
    privacy = None
    if include_public:
        privacy = Project.PUBLIC

    if user is None or user.is_anonymous:
        # Unauthenticated users see public projects.
        cond = Q(privacy=Project.PUBLIC)
    else:
        # Authenticated users see public projects and private projects with access rights.
        cond = Q(owner=user, privacy=Project.PRIVATE) | \
               Q(privacy=privacy) | \
               Q(access__user=user, access__access__in=[Access.READ_ACCESS,
                                                        Access.WRITE_ACCESS,
                                                        Access.SHARE_ACCESS])
    # Generate the query.
    if include_deleted:
        query = Project.objects.filter(cond).distinct()
    else:
        query = Project.objects.filter(cond, deleted=False).distinct()

    return query
def get_project_list ( user , include_public = True , include_deleted = False ) : privacy = None if include_public : privacy = Project . PUBLIC if user is None or user . is_anonymous : # Unauthenticated users see public projects. cond = Q ( privacy = Project . PUBLIC ) else : # Authenticated users see public projects and private projects with access rights. cond = Q ( owner = user , privacy = Project . PRIVATE ) | Q ( privacy = privacy ) | Q ( access__user = user , access__access__in = [ Access . READ_ACCESS , Access . WRITE_ACCESS , Access . SHARE_ACCESS ] ) # Generate the query. if include_deleted : query = Project . objects . filter ( cond ) . distinct ( ) else : query = Project . objects . filter ( cond , deleted = False ) . distinct ( ) return query