Esempio n. 1
0
def manager_proposition_dissertation_detail(request, pk):
    proposition = proposition_dissertation.find_by_id(pk)
    if proposition is None:
        return redirect('manager_proposition_dissertations')
    offer_propositions = proposition_offer.find_by_proposition_dissertation(proposition)
    person = mdl.person.find_by_user(request.user)
    adv = adviser.search_by_person(person)
    count_use = dissertation.count_by_proposition(proposition)
    percent = count_use * 100 / proposition.max_number_student if proposition.max_number_student else 0
    count_proposition_role = proposition_role.count_by_proposition(proposition)
    files = proposition_document_file.find_by_proposition(proposition)
    filename = ""
    for file in files:
        filename = file.document_file.file_name
    if count_proposition_role < 1:
        proposition_role.add('PROMOTEUR', proposition.author, proposition)
    proposition_roles = proposition_role.search_by_proposition(proposition)
    return layout.render(request, 'manager_proposition_dissertation_detail.html',
                         {'proposition_dissertation': proposition,
                          'offer_propositions': offer_propositions,
                          'adviser': adv,
                          'count_use': count_use,
                          'percent': round(percent, 2),
                          'proposition_roles': proposition_roles,
                          'count_proposition_role': count_proposition_role,
                          'filename': filename})
Esempio n. 2
0
def proposition_dissertation_detail(request, pk):
    subject = get_object_or_404(
        proposition_dissertation.PropositionDissertation, pk=pk)
    offer_propositions = proposition_offer.search_by_proposition_dissertation(
        subject)
    person = mdl.person.find_by_user(request.user)
    student = mdl.student.find_by_person(person)
    using = dissertation.count_by_proposition(subject)
    percent = using * 100 / subject.max_number_student if subject.max_number_student else 0
    count_proposition_role = proposition_role.count_by_proposition(subject)
    files = proposition_document_file.find_by_proposition(subject)
    filename = ""
    for file in files:
        filename = file.document_file.file_name
    if count_proposition_role < 1:
        proposition_role.add('PROMOTEUR', subject.author, subject)
    proposition_roles = proposition_role.search_by_proposition(subject)
    return layout.render(
        request, 'proposition_dissertation_detail.html', {
            'percent': round(percent, 2),
            'proposition_roles': proposition_roles,
            'proposition_dissertation': subject,
            'offer_propositions': offer_propositions,
            'student': student,
            'using': using,
            'filename': filename
        })
Esempio n. 3
0
def manager_proposition_dissertation_detail(request, pk):
    prefetch_propositions = return_prefetch_propositions()
    proposition = get_object_or_404(
        PropositionDissertation.objects.select_related(
            'author__person', 'creator').prefetch_related(
                prefetch_propositions,
                'offer_propositions__education_group__educationgroupyear_set',
                'propositionrole_set__adviser__person',
            ),
        pk=pk)
    adv = request.user.person.adviser
    count_use = dissertation.count_by_proposition(proposition)
    percent = count_use * 100 / proposition.max_number_student if proposition.max_number_student else 0
    count_proposition_role = proposition_role.count_by_proposition(proposition)
    files = proposition_document_file.find_by_proposition(proposition)
    filename = ""
    for file in files:
        filename = file.document_file.file_name
    if count_proposition_role < 1:
        proposition_role.add(dissertation_role_status.PROMOTEUR,
                             proposition.author, proposition)
    return render(
        request, 'manager_proposition_dissertation_detail.html', {
            'proposition_dissertation': proposition,
            'adviser': adv,
            'count_use': count_use,
            'percent': round(percent, 2),
            'count_proposition_role': count_proposition_role,
            'filename': filename
        })
Esempio n. 4
0
def proposition_dissertation_detail(request, pk):
    current_academic_year = academic_year.current_academic_year()

    prefetch_disserts = Prefetch(
        "dissertations",
        queryset=Dissertation.objects.filter(active=True).filter(
            education_group_year__academic_year=current_academic_year).exclude(
                status__in=(dissertation_status.DRAFT,
                            dissertation_status.DIR_KO)))
    prefetch_offer_propositions = return_prefetch_propositions()

    proposition = get_object_or_404(
        PropositionDissertation.objects.select_related(
            'author__person', 'creator').prefetch_related(
                prefetch_offer_propositions, prefetch_disserts,
                'propositionrole_set__adviser__person'),
        pk=pk)
    check_authorisation_of_proposition = autorized_proposition_dissert_promotor_or_manager_or_author(
        request.user, proposition)
    offer_propositions = proposition.offer_propositions.all()
    count_use = proposition.dissertations.all().count()
    percent = count_use * 100 / proposition.max_number_student if proposition.max_number_student else 0
    count_proposition_role = proposition.propositionrole_set.all().count()
    files = proposition_document_file.find_by_proposition(proposition)
    filename = ""
    for file in files:
        filename = file.document_file.file_name
    if count_proposition_role < 1:
        proposition_role.add(dissertation_role_status.PROMOTEUR,
                             proposition.author, proposition)
    proposition_roles = PropositionRole.objects.filter(proposition_dissertation=proposition) \
        .select_related('adviser__person')
    return render(
        request, 'proposition_dissertation_detail.html', {
            'proposition_dissertation': proposition,
            'check_authorisation_of_proposition':
            check_authorisation_of_proposition,
            'offer_propositions': offer_propositions,
            'adviser': get_current_adviser(request),
            'count_use': count_use,
            'percent': round(percent, 2),
            'proposition_roles': proposition_roles,
            'count_proposition_role': count_proposition_role,
            'filename': filename
        })
def proposition_dissertation_detail(request, pk):
    subject = get_object_or_404(proposition_dissertation.PropositionDissertation, pk=pk)
    offer_propositions = proposition_offer.search_by_proposition_dissertation(subject)
    person = mdl.person.find_by_user(request.user)
    student = mdl.student.find_by_person(person)
    using = dissertation.count_by_proposition(subject)
    percent = using * 100 / subject.max_number_student if subject.max_number_student else 0
    count_proposition_role = proposition_role.count_by_proposition(subject)
    files = proposition_document_file.find_by_proposition(subject)
    filename = ""
    for file in files:
        filename = file.document_file.file_name
    if count_proposition_role < 1:
        proposition_role.add('PROMOTEUR', subject.author, subject)
    proposition_roles = proposition_role.search_by_proposition(subject)
    return layout.render(request, 'proposition_dissertation_detail.html',
                         {'percent': round(percent, 2),
                          'proposition_roles': proposition_roles,
                          'proposition_dissertation': subject,
                          'offer_propositions': offer_propositions,
                          'student': student,
                          'using': using,
                          'filename': filename})