示例#1
0
def dissertations_to_dir_ko(request, pk):
    dissert = dissertation.find_by_id(pk)
    if dissert is None:
        return redirect('dissertations_list')
    person = mdl.person.find_by_user(request.user)
    adv = adviser.search_by_person(person)

    if teacher_is_promotor(adv, dissert):
        old_status = dissert.status
        new_status = dissertation.get_next_status(dissert, "refuse")
        status_dict = dict(dissertation.STATUS_CHOICES)
        new_status_display = status_dict[new_status]

        if request.method == "POST":
            form = ManagerDissertationUpdateForm(request.POST)
            if form.is_valid():
                dissert.refuse()
                data = form.cleaned_data
                justification = data['justification']
                dissertation_update.add(request, dissert, old_status, justification=justification)
                return redirect('dissertations_detail', pk=pk)

        else:
            form = ManagerDissertationUpdateForm()

        return layout.render(request, 'dissertations_add_justification.html',
                             {'form': form, 'dissert': dissert, 'new_status_display': new_status_display})

    else:
        return redirect('dissertations_detail', pk=pk)
示例#2
0
def manager_dissertations_to_dir_submit(request, pk):
    dissert = dissertation.find_by_id(pk)
    if dissert is None:
        return redirect('manager_dissertations_list')
    old_status = dissert.status
    new_status_display_str = new_status_display(dissert, "go_forward")
    if request.method == "POST":
        form = ManagerDissertationUpdateForm(request.POST)
        if form.is_valid():
            dissert.go_forward()
            data = form.cleaned_data
            justification = data['justification']
            dissertation_update.add(request,
                                    dissert,
                                    old_status,
                                    justification=justification)
            return redirect('manager_dissertations_detail', pk=pk)
    else:
        form = ManagerDissertationUpdateForm()
    return render(
        request, 'manager_dissertations_add_justification.html', {
            'form': form,
            'dissert': dissert,
            'new_status_display': new_status_display_str
        })
def manager_dissertations_to_dir_ok(request, pk):
    dissert = dissertation.find_by_id(pk)
    redirect_if_none(dissert, 'manager_dissertations_list')
    person = mdl.person.find_by_user(request.user)
    adv = adviser.search_by_person(person)
    if (adviser_can_manage(dissert, adv)):
        old_status = dissert.status
        new_status = dissertation.get_next_status(dissert, "accept")
        status_dict = dict(dissertation.STATUS_CHOICES)
        new_status_display = status_dict[new_status]

        if request.method == "POST":
            form = ManagerDissertationUpdateForm(request.POST)
            if form.is_valid():
                dissert.manager_accept()
                data = form.cleaned_data
                justification = data['justification']
                dissertation_update.add(request, dissert, old_status, justification=justification)
                return redirect('manager_dissertations_detail', pk=pk)

        else:
            form = ManagerDissertationUpdateForm()

        return layout.render(request, 'manager_dissertations_add_justification.html',
                             {'form': form, 'dissert': dissert, 'new_status_display': new_status_display})
    else:
        return redirect('manager_dissertations_list')
示例#4
0
def dissertations_to_dir_ko(request, pk):
    dissert = get_object_or_404(
        Dissertation.objects.select_related('author__person'), pk=pk)
    old_status = dissert.status
    new_status_display_result = new_status_display(dissert, "refuse")
    if request.method == "POST":
        form = ManagerDissertationUpdateForm(request.POST)
        if form.is_valid():
            dissert.refuse()
            data = form.cleaned_data
            justification = data['justification']
            dissertation_update.add(request,
                                    dissert,
                                    old_status,
                                    justification=justification)
            return redirect('dissertations_detail', pk=pk)
    else:
        form = ManagerDissertationUpdateForm()
    return render(
        request, 'dissertations_add_justification.html', {
            'form': form,
            'dissert': dissert,
            'new_status_display': new_status_display_result
        })
示例#5
0
def manager_dissertations_to_dir_ok(request, pk):
    dissert = dissertation.find_by_id(pk)
    old_status = dissert.status
    new_status_display_result = new_status_display(dissert, "accept")
    if request.method == "POST":
        form = ManagerDissertationUpdateForm(request.POST)
        if form.is_valid():
            dissert.manager_accept()
            data = form.cleaned_data
            justification = data['justification']
            dissertation_update.add(request,
                                    dissert,
                                    old_status,
                                    justification=justification)
            return redirect('manager_dissertations_detail', pk=pk)
    else:
        form = ManagerDissertationUpdateForm()

    return render(
        request, 'manager_dissertations_add_justification.html', {
            'form': form,
            'dissert': dissert,
            'new_status_display': new_status_display_result
        })