Fix for ticket #4 (charts)
This commit is contained in:
@@ -30,7 +30,7 @@ from django.core.urlresolvers import reverse
|
|||||||
from django.core.paginator import Paginator, InvalidPage, EmptyPage, PageNotAnInteger
|
from django.core.paginator import Paginator, InvalidPage, EmptyPage, PageNotAnInteger
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from django.db.models import Sum
|
from django.db.models import Sum, Max
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from os.path import join as pjoin
|
from os.path import join as pjoin
|
||||||
from tipp.models import *
|
from tipp.models import *
|
||||||
@@ -414,7 +414,6 @@ def charts(request, ls, season, pos='default', template_name='charts.html'):
|
|||||||
'pos': pos
|
'pos': pos
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def blogindex(request, page):
|
def blogindex(request, page):
|
||||||
# get the blog posts that are published
|
# get the blog posts that are published
|
||||||
@@ -496,7 +495,13 @@ def logout(request):
|
|||||||
|
|
||||||
def get_current_md(ls,season):
|
def get_current_md(ls,season):
|
||||||
""" get current matchday """
|
""" get current matchday """
|
||||||
current_md = Match.objects.filter(leagueShortcut=ls, season=season, finished=False).order_by('matchday').values_list('matchday', flat=True).distinct()[0]
|
try:
|
||||||
|
current_md = Match.objects.filter(leagueShortcut=ls, season=season, \
|
||||||
|
finished=False).order_by('matchday').values_list('matchday', \
|
||||||
|
flat=True).distinct()[0]
|
||||||
|
except IndexError:
|
||||||
|
current_md = Match.objects.filter(leagueShortcut=ls, season=season).aggregate(Max('matchday'))
|
||||||
|
|
||||||
return(current_md)
|
return(current_md)
|
||||||
|
|
||||||
def get_current_ls():
|
def get_current_ls():
|
||||||
|
|||||||
Reference in New Issue
Block a user