diff --git a/core/utils.py b/core/utils.py index b3f04ee6..442325fe 100644 --- a/core/utils.py +++ b/core/utils.py @@ -83,13 +83,13 @@ def queryset_to_workbook(queryset, columns, report_date = None): 'pattern: pattern solid, fore_color gray_ega;', ) odd_style = xlwt.Style.easyxf( - 'font: name Calibri, height 300, bold False;' + 'font: name Calibri, height 240, bold False;' 'borders: left thin, right thin, top thin, bottom thin;' 'alignment: horizontal center, vertical center, wrap True;' 'pattern: pattern solid, fore_color white;', ) even_style = xlwt.Style.easyxf( - 'font: name Calibri, height 300, bold False;' + 'font: name Calibri, height 240, bold False;' 'borders: left thin, right thin, top thin, bottom thin;' 'alignment: horizontal center, vertical center, wrap True;' 'pattern: pattern solid, fore_color silver_ega;', diff --git a/core/views.py b/core/views.py index d762dc01..08ecb20c 100644 --- a/core/views.py +++ b/core/views.py @@ -266,13 +266,18 @@ def download_workbook(request): lang = get_language() data = request.GET if data: - qs = [] - for i,obj in enumerate(data): - if data.get('data[%i][name]' % i) == 'expo': - qs.append(Exposition.objects.language(lang).get(id=data['data[%i][value]'%i])) - elif data.get('data[%i][name]' % i) == 'conf': - qs.append(Conference.objects.language(lang).get(id=data['data[%i][value]'%i])) - + if data.get('filter') == u'future': + qs = request.user.calendar.get_events() + qs = [event for event in qs if event.data_begin > datetime.date.today()] + else: + qs = [] + for i,obj in enumerate(data): + if data.get('data[%i][name]' % i) == 'expo': + qs.append(Exposition.objects.language(lang).get(id=data['data[%i][value]'%i])) + elif data.get('data[%i][name]' % i) == 'conf': + qs.append(Conference.objects.language(lang).get(id=data['data[%i][value]'%i])) + if not qs: + return HttpResponseRedirect("/profile/calendar/?message=empty") earliest_event = qs[0].data_begin for i, obj in enumerate(qs, start=1): if obj.data_begin < earliest_event: @@ -305,4 +310,4 @@ def download_workbook(request): workbook.save(response) return response else: - return HttpResponseRedirect(request.META.get('HTTP_REFERER'), "/profile/calendar/") + return HttpResponseRedirect("/profile/calendar/") diff --git a/templates/client/accounts/calendar.html b/templates/client/accounts/calendar.html index 6a1f8502..36e0eb31 100644 --- a/templates/client/accounts/calendar.html +++ b/templates/client/accounts/calendar.html @@ -20,14 +20,18 @@ {% block content_list %}