Esempio n. 1
0
File: views.py Progetto: kfarr2/mlp
def workflow(request):
    """
    Workflow page. Basically a home/profile page for users
    that do not have admin access.
    """
    groups_list = Roster.objects.filter(user=request.user).values("group")
    groups = Group.objects.filter(group_id__in=groups_list)
    num_groups = groups_list.count()
    form = FileSearchForm(request.GET, user=request.user)
    form.is_valid()
    files = form.results(page=request.GET.get("page"))
    num_files = File.objects.filter(uploaded_by=request.user).count()

    return render(
        request,
        "users/workflow.html",
        {
            "num_groups": num_groups,
            "num_files": num_files,
            "groups": groups,
            "files": files,
            "FileType": FileType,
            "FileStatus": FileStatus,
        },
    )
Esempio n. 2
0
def file_list(request, slug):
    """
    View that allows an admin to view the files in their class.
    """
    group = get_object_or_404(Group, slug=slug)
    group_files = GroupFile.objects.filter(group=group).values('file')
    group_files = File.objects.filter(file_id__in=group_files, status=FileStatus.READY)
    form = FileSearchForm(request.GET, user=request.user)
    files = form.results(page=request.GET.get("page")).object_list
    all_files = File.objects.filter(status=FileStatus.READY)

    return render(request, "groups/add_file.html", {
        "form": form,
        "all_files": all_files,
        "files": files,
        "group": group,
        "group_files": group_files,
        'FileType': FileType,
        'FileStatus': FileStatus,
    })
Esempio n. 3
0
def file_list(request, slug):
    """
    View that allows an admin to view the files in their class.
    """
    group = get_object_or_404(Group, slug=slug)
    group_files = GroupFile.objects.filter(group=group).values('file')
    group_files = File.objects.filter(file_id__in=group_files,
                                      status=FileStatus.READY)
    form = FileSearchForm(request.GET, user=request.user)
    files = form.results(page=request.GET.get("page")).object_list
    all_files = File.objects.filter(status=FileStatus.READY)

    return render(
        request, "groups/add_file.html", {
            "form": form,
            "all_files": all_files,
            "files": files,
            "group": group,
            "group_files": group_files,
            'FileType': FileType,
            'FileStatus': FileStatus,
        })
Esempio n. 4
0
def workflow(request):
    """
    Workflow page. Basically a home/profile page for users
    that do not have admin access.
    """
    groups_list = Roster.objects.filter(user=request.user).values('group')
    groups = Group.objects.filter(group_id__in=groups_list)
    num_groups = groups_list.count()
    form = FileSearchForm(request.GET, user=request.user)
    form.is_valid()
    files = form.results(page=request.GET.get("page"))
    num_files = File.objects.filter(uploaded_by=request.user).count()

    return render(
        request, "users/workflow.html", {
            "num_groups": num_groups,
            "num_files": num_files,
            "groups": groups,
            "files": files,
            'FileType': FileType,
            'FileStatus': FileStatus,
        })