Merge branch 'iss02'

This commit is contained in:
2016-06-07 18:20:35 +02:00
11 changed files with 22 additions and 46 deletions

View File

@@ -481,17 +481,6 @@ def blogindex(request, page):
'page': page
})
@login_required
def blogpost(request, slug):
# get the Post object
post = get_object_or_404(Post, slug=slug)
# now return the rendered template
return render(request, 'blogpost.html', {
'post': post,
'ls': get_current_ls(),
'season': get_current_season()
})
@login_required
def newBlogpost(request):
"""
@@ -502,12 +491,8 @@ def newBlogpost(request):
form = BlogpostForm(request.POST)
# check whether it's valid:
if form.is_valid():
# process the data
# fix me
# What to to, if subject is empty?
data = form.cleaned_data
slug = slugify(data['title'])
p = Post(author_id=request.user.id, slug=slug, title=data['title'], content=data['content'])
p = Post(author_id=request.user.id, content=data['content'])
p.save()
# ...
@@ -532,13 +517,17 @@ def logout(request):
def get_current_md(ls,season):
""" get current matchday """
"""
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'))
except:
current_md = 34
"""
current_md = 34
return(current_md)
def get_current_ls():