Пример #1
0
def user_list(request, facility):
    return user_management_context(
        request=request,
        facility_id=facility.id,
        group_id=request.REQUEST.get("group", ""),
        page=request.REQUEST.get("page", "1"),
    )
Пример #2
0
def user_list(request,facility):
    return user_management_context(
        request=request,
        facility_id=facility.id,
        group_id=request.REQUEST.get("group",""),
        page=request.REQUEST.get("page","1"),
    )
Пример #3
0
def user_list(request, facility):

    # Use default group
    group_id = request.REQUEST.get("group")
    if not group_id:
        groups = FacilityGroup.objects \
            .annotate(Count("facilityuser")) \
            .filter(facilityuser__count__gt=0)
        ngroups = groups.count()
        ngroups += int(FacilityUser.objects.filter(group__isnull=True).count() > 0)
        if ngroups == 1:
            group_id = groups[0].id if groups.count() else "Ungrouped"

    context = user_management_context(
        request=request,
        facility_id=facility.id,
        group_id=group_id,
        page=request.REQUEST.get("page","1"),
    )
    context.update({
        "singlefacility": Facility.objects.count() == 1,
    })
    return context