Merge pull request #625 from pcoder/bugfix/4481/fix_DE_blog_pages_500_error

Bugfix/4481/fix de blog pages 500 error
This commit is contained in:
Arvind Tiwari 2018-04-21 22:54:18 +05:30 committed by GitHub
commit 49c0406296
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@ import logging
from django.conf import settings
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.http import HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse_lazy, reverse
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView, UpdateView
@ -834,8 +834,9 @@ class ContactView(FormView):
def blog(request):
tags = ["digitalglarus"]
posts = Post.objects.filter(tags__name__in=tags, publish=True).translated(get_language())
# posts = Post.objects.filter_by_language(get_language()).filter(tags__name__in=tags, publish=True)
posts = (Post.objects
.filter(tags__name__in=tags, publish=True)
.translated(get_language()))
context = {
'post_list': posts,
}
@ -843,9 +844,9 @@ def blog(request):
def blog_detail(request, slug):
# post = Post.objects.filter_by_language(get_language()).filter(slug=slug).first()
post = Post.objects.translated(get_language(), slug=slug).first()
if post is None:
raise Http404()
context = {
'post': post,
}