Fixed safari download bug
This commit is contained in:
parent
f69c1e6318
commit
315e44adb1
1 changed files with 8 additions and 12 deletions
|
@ -28,8 +28,6 @@ def tofirstdayinisoweek(year, week):
|
|||
return ret
|
||||
|
||||
def index(request):
|
||||
template = loader.get_template('index.html')
|
||||
|
||||
if request.user.is_authenticated:
|
||||
now = datetime.today()
|
||||
|
||||
|
@ -57,19 +55,18 @@ def index(request):
|
|||
now + timedelta(days=6-weekday))) \
|
||||
.aggregate(s=Sum('count'))
|
||||
|
||||
return HttpResponse(template.render({
|
||||
context = {
|
||||
'yearArrows': yearArrows,
|
||||
'monthArrows': 0 if monthArrows['s'] is None else monthArrows['s'],
|
||||
'weekArrows': 0 if weekArrows['s'] is None else weekArrows['s'],
|
||||
'diffTarget': diff_target
|
||||
}, request))
|
||||
}
|
||||
return render(request, 'index.html', context)
|
||||
else:
|
||||
return HttpResponse(template.render({}), request)
|
||||
return render(request, 'index.html', {})
|
||||
|
||||
@login_required
|
||||
def count_stats(request):
|
||||
template = loader.get_template('stats.html')
|
||||
|
||||
# Group counts by week (extract isoyear works only on psql and DB2)
|
||||
weeklyArrows = ArrowCount.objects \
|
||||
.filter(user = request.user) \
|
||||
|
@ -83,9 +80,9 @@ def count_stats(request):
|
|||
w['weekStarts'] = tofirstdayinisoweek(w['isoyear'], w['week'])
|
||||
w['weekEnds'] = w['weekStarts'] + timedelta(days=6)
|
||||
|
||||
return HttpResponse(template.render({
|
||||
return render(request, 'counter/stats.html', {
|
||||
'weeklyArrows': json.dumps(list(weeklyArrows), cls=DjangoJSONEncoder)
|
||||
}, request))
|
||||
})
|
||||
|
||||
@login_required
|
||||
def arrow_count_export(request):
|
||||
|
@ -125,12 +122,11 @@ def arrow_count_list(request):
|
|||
|
||||
pageCount = math.ceil(ArrowCount.objects.filter(user = request.user).count() / \
|
||||
settings.ITEMS_PER_PAGE)
|
||||
template = loader.get_template('counter/list.html')
|
||||
return HttpResponse(template.render({
|
||||
return render(request, 'counter/list.html', {
|
||||
'counts': counts,
|
||||
'pageCount': pageCount,
|
||||
'page': page
|
||||
}, request))
|
||||
})
|
||||
|
||||
class NewArrowCount(generic.CreateView):
|
||||
form_class = ArrowCountForm
|
||||
|
|
Loading…
Reference in a new issue