Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def list_of_programs_and_textbooks(request):
- resp_dict = {}
- request_context = request.app_context
- context_institute = request_context['context_institute']
- today = datetime.now().date()
- edu_year = request_context['edu_year']
- redirect_url = '/'
- if request.META.has_key('HTTP_REFERER'):
- redirect_url = request.META['HTTP_REFERER']
- subjects = ASIOU_I_Subject.objects.filter(institute=context_institute).order_by('name')
- resp_dict['CHOISE_TYPE_MARKS_OOU'] = CHOISE_TYPE_MARKS_OOU
- resp_dict['subjects'] = subjects
- if request.method == 'POST':
- post = request.POST.copy()
- start_date = None
- end_date = None
- subjects_id = []
- for key in post:
- if key.find('s_') != -1:
- subjects_id.append(int(key.split('_')[1]))
- elif key == 'start_date':
- start_year = post[key]
- elif key == 'end_date':
- end_year = post[key]
- groups = ASIOU_G_Education.objects.filter(institute=context_institute,
- education_year__in=range(int(start_year), int(end_year)),
- type__label__in=['group_10', 'group_01'])
- ep_group = ASIOU_EP_Group.objects.filter(
- institute=context_institute,
- group__id__in=groups,
- subject__id__in=subjects_id
- )
- print 'ep_group', ep_group
- school_prog = group_by(ASIOU_EP_ProgBook.objects.filter(institute=context_institute,
- group__id__in=ep_group,
- prog_book__type__label__startswith='dict_programm_').values(
- 'group__group__id', 'prog_book__author_name'), 'group__group__id')
- resp_dict['ep_group'] = ep_group
- resp_dict['school_prog'] = school_prog
- resp_dict['start_year'] = start_year
- resp_dict['end_year'] = end_year
- print 'school_prog', school_prog
- response = render(request, 'reports/list_of_programs_and_textbooks.html', resp_dict)
- if request.GET.has_key('print_word'):
- resp_dict['print'] = True
- response['Content-Type'] = 'application/vnd.ms-word'
- response['Content-Disposition'] = 'attachment; filename=Перечень_учебников_и_программ.doc'
- return response
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement