(request, uid)
return render(request, "project_users.html", context=context)
Manage project users page
Manage project users page
Manage project users page
def project_users(request, uid):
    """
    Manage project users page
    """
    project = Project.objects.filter(uid=uid).first()
    # Get users that already have access to project.
    have_access = project.access_set.exclude(access=Access.NO_ACCESS).order_by('-date')

    # Search query for users.
    q = request.GET.get("q", "")
    if q:
        selected = have_access.values('user')
        targets = User.objects.filter(Q(email__contains=q) | Q(profile__name__contains=q) |
                                      Q(username__contains=q) |
                                      Q(profile__uid__contains=q)).exclude(id__in=selected)
    else:
        targets = []

    # Gather access forms for users who currently have access
    context = dict(project=project, have_access=have_access, q=q, targets=targets, activate='User Management')

    counts = get_counts(project)
    context.update(counts)

    return render(request, "project_users.html", context=context)
def project_users ( request , uid ) : project = Project . objects . filter ( uid = uid ) . first ( ) # Get users that already have access to project. have_access = project . access_set . exclude ( access = Access . NO_ACCESS ) . order_by ( '-date' ) # Search query for users. q = request . GET . get ( "q" , "" ) if q : selected = have_access . values ( 'user' ) targets = User . objects . filter ( Q ( email__contains = q ) | Q ( profile__name__contains = q ) | Q ( username__contains = q ) | Q ( profile__uid__contains = q ) ) . exclude ( id__in = selected ) else : targets = [ ] # Gather access forms for users who currently have access context = dict ( project = project , have_access = have_access , q = q , targets = targets , activate = 'User Management' ) counts = get_counts ( project ) context . update ( counts ) return render ( request , "project_users.html" , context = context )