def manager_dissertations_list(request): disserts = Dissertation.objects.filter( education_group_year__education_group__facultyadviser__adviser__person__user =request.user, active=True).select_related( 'author__person', 'education_group_year', 'education_group_year__academic_year', 'proposition_dissertation__author__person').distinct() offer_props = OfferProposition.objects.filter( education_group__facultyadviser__adviser__person__user=request.user ).distinct() year = timezone.now().year academic_year_10y = AcademicYear.objects.filter(year__gte=year - 10, year__lte=year + 1) show_validation_commission = offer_proposition.show_validation_commission( offer_props) show_evaluation_first_year = offer_proposition.show_evaluation_first_year( offer_props) return render( request, 'manager_dissertations_list.html', { 'dissertations': disserts, 'show_validation_commission': show_validation_commission, 'show_evaluation_first_year': show_evaluation_first_year, 'academic_year_10y': academic_year_10y, 'offer_props': offer_props })
def manager_dissertations_search(request): person = mdl.person.find_by_user(request.user) adv = adviser.search_by_person(person) offers = faculty_adviser.search_by_adviser(adv) disserts = dissertation.search(terms=request.GET.get('search', ''), active=True) disserts = disserts.filter(offer_year_start__offer__in=offers) offer_prop_search = request.GET.get('offer_prop_search', '') academic_year_search = request.GET.get('academic_year', '') status_search = request.GET.get('status_search', '') if offer_prop_search != '': offer_prop_search = int(offer_prop_search) offer_prop = offer_proposition.find_by_id(offer_prop_search) disserts = disserts.filter(offer_year_start__offer=offer_prop.offer) if academic_year_search != '': academic_year_search = int(academic_year_search) disserts = disserts.filter( offer_year_start__academic_year=academic_year. find_academic_year_by_id(academic_year_search)) if status_search != '': disserts = disserts.filter(status=status_search) offer_props = offer_proposition.search_by_offer(offers) show_validation_commission = offer_proposition.show_validation_commission( offer_props) show_evaluation_first_year = offer_proposition.show_evaluation_first_year( offer_props) start_date = timezone.now().replace(year=timezone.now().year - 10) end_date = timezone.now().replace(year=timezone.now().year + 1) academic_year_10y = academic_year.find_academic_years(end_date, start_date) if 'bt_xlsx' in request.GET: xls = generate_xls(disserts) filename = 'dissertations_{}.xlsx'.format( time.strftime("%Y-%m-%d_%H:%M")) response = HttpResponse( xls, content_type= 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ) response['Content-Disposition'] = "%s%s" % ("attachment; filename=", filename) return response else: return layout.render( request, "manager_dissertations_list.html", { 'dissertations': disserts, 'show_validation_commission': show_validation_commission, 'show_evaluation_first_year': show_evaluation_first_year, 'academic_year_10y': academic_year_10y, 'offer_props': offer_props, 'offer_prop_search': offer_prop_search, 'academic_year_search': academic_year_search, 'status_search': status_search })
def manager_dissertations_wait_recep_list(request): person = mdl.person.find_by_user(request.user) adv = adviser.search_by_person(person) offers = faculty_adviser.search_by_adviser(adv) offer_props = offer_proposition.search_by_offer(offers) show_validation_commission = offer_proposition.show_validation_commission(offer_props) show_evaluation_first_year = offer_proposition.show_evaluation_first_year(offer_props) disserts = dissertation.search_by_offer_and_status(offers, "TO_RECEIVE") return layout.render(request, 'manager_dissertations_wait_recep_list.html', {'dissertations': disserts, 'show_validation_commission': show_validation_commission, 'show_evaluation_first_year': show_evaluation_first_year})
def manager_dissertations_wait_comm_list(request): person = mdl.person.find_by_user(request.user) adv = adviser.search_by_person(person) offers = faculty_adviser.search_by_adviser(adv) offer_props = offer_proposition.search_by_offer(offers) all_advisers_array = str(adviser.convert_advisers_to_array(adviser.find_all_advisers())) show_validation_commission = offer_proposition.show_validation_commission(offer_props) show_evaluation_first_year = offer_proposition.show_evaluation_first_year(offer_props) return layout.render(request, 'manager_dissertations_wait_commission_list.html', {'show_validation_commission': show_validation_commission, 'STATUS_CHOICES': STATUS_CHOICES, 'show_evaluation_first_year': show_evaluation_first_year, 'all_advisers_array': all_advisers_array})
def manager_dissertations_list(request): person = mdl.person.find_by_user(request.user) adv = adviser.search_by_person(person) offers = faculty_adviser.search_by_adviser(adv) disserts = dissertation.search_by_offer(offers) offer_props = offer_proposition.search_by_offer(offers) start_date=timezone.now().replace(year=timezone.now().year - 10) end_date=timezone.now().replace(year=timezone.now().year + 1) academic_year_10y=find_academic_years(end_date,start_date) show_validation_commission = offer_proposition.show_validation_commission(offer_props) show_evaluation_first_year = offer_proposition.show_evaluation_first_year(offer_props) return layout.render(request, 'manager_dissertations_list.html', {'dissertations': disserts, 'show_validation_commission': show_validation_commission, 'show_evaluation_first_year': show_evaluation_first_year, 'academic_year_10y': academic_year_10y, 'offer_props':offer_props})
def manager_dissertations_wait_comm_list(request): offer_props = OfferProposition.objects.filter( education_group__facultyadviser__adviser__person__user=request.user ).distinct() all_advisers_array = str( adviser.convert_advisers_to_array( adviser.Adviser.objects.all().select_related('person'))) show_validation_commission = offer_proposition.show_validation_commission( offer_props) show_evaluation_first_year = offer_proposition.show_evaluation_first_year( offer_props) return render( request, 'manager_dissertations_wait_commission_list.html', { 'show_validation_commission': show_validation_commission, 'STATUS_CHOICES': dissertation_role_status.STATUS_CHOICES, 'show_evaluation_first_year': show_evaluation_first_year, 'all_advisers_array': all_advisers_array })
def manager_dissertations_wait_recep_list(request): offer_props = OfferProposition.objects.filter(education_group__facultyadviser__adviser__person__user=request.user).\ distinct() show_validation_commission = offer_proposition.show_validation_commission( offer_props) show_evaluation_first_year = offer_proposition.show_evaluation_first_year( offer_props) disserts = Dissertation.objects.filter( education_group_year__education_group__facultyadviser__adviser__person__user =request.user, active=True, status=dissertation_status.TO_RECEIVE).select_related( 'author__person', 'education_group_year__academic_year', 'proposition_dissertation__author__person') return render( request, 'manager_dissertations_wait_recep_list.html', { 'dissertations': disserts, 'show_validation_commission': show_validation_commission, 'show_evaluation_first_year': show_evaluation_first_year })
def manager_dissertations_search(request): terms = request.GET.get('search', '') disserts = Dissertation.objects.filter( education_group_year__education_group__facultyadviser__adviser__person__user =request.user, active=True ).filter( Q(author__person__first_name__icontains=terms) | Q(author__person__middle_name__icontains=terms) | Q(author__person__last_name__icontains=terms) | Q(description__icontains=terms) | Q(proposition_dissertation__title__icontains=terms) | Q(proposition_dissertation__author__person__first_name__icontains=terms ) | Q(proposition_dissertation__author__person__middle_name__icontains=terms ) | Q(proposition_dissertation__author__person__last_name__icontains=terms) | Q(status__icontains=terms) | Q(title__icontains=terms) | Q(education_group_year__acronym__icontains=terms)).select_related( 'author__person', 'education_group_year', 'education_group_year__academic_year', 'proposition_dissertation__author__person').distinct() offer_prop_search = request.GET.get('offer_prop_search', '') academic_year_search = request.GET.get('academic_year', '') status_search = request.GET.get('status_search', '') if offer_prop_search != '': offer_prop_search = int(offer_prop_search) offer_prop = offer_proposition.find_by_id(offer_prop_search) disserts = disserts.filter( education_group_year__education_group=offer_prop.education_group) if academic_year_search != '': academic_year_search = int(academic_year_search) disserts = disserts.filter( education_group_year__academic_year=academic_year. find_academic_year_by_id(academic_year_search)) if status_search != '': disserts = disserts.filter(status=status_search) offer_props = OfferProposition.objects.filter( education_group__facultyadviser__adviser__person__user=request.user ).distinct() show_validation_commission = offer_proposition.show_validation_commission( offer_props) show_evaluation_first_year = offer_proposition.show_evaluation_first_year( offer_props) year = timezone.now().year academic_year_10y = AcademicYear.objects.filter(year__gte=year - 10, year__lte=year + 1) if 'bt_xlsx' in request.GET: xls = generate_xls(disserts) filename = 'dissertations_{}.xlsx'.format( time.strftime("%Y-%m-%d_%H:%M")) response = HttpResponse( xls, content_type= 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ) response['Content-Disposition'] = "%s%s" % ("attachment; filename=", filename) return response else: return render( request, "manager_dissertations_list.html", { 'dissertations': disserts, 'show_validation_commission': show_validation_commission, 'show_evaluation_first_year': show_evaluation_first_year, 'academic_year_10y': academic_year_10y, 'offer_props': offer_props, 'offer_prop_search': offer_prop_search, 'academic_year_search': academic_year_search, 'status_search': status_search })