As an admin I want to be able to create a custom use. As an user I want to see listed only posts in the current selected language. As an user I want to be able to switch languages between EN-DE

This commit is contained in:
Levi 2016-06-23 21:32:51 -05:00
commit 2b50f9fdd9
7 changed files with 49 additions and 12 deletions

View file

@ -1,3 +1,4 @@
from django.conf import settings
from django.shortcuts import render
from django.utils.translation import get_language
from djangocms_blog.models import Post
@ -8,7 +9,6 @@ from djangocms_blog.settings import get_setting
def blog(request):
posts = Post.objects.all()
print(posts)
context = {
'post_list': posts
}
@ -26,6 +26,9 @@ class PostListViewUngleich(PostListView):
def get_context_data(self, **kwargs):
context = super(PostListView, self).get_context_data(**kwargs)
context['TRUNCWORDS_COUNT'] = get_setting('POSTS_LIST_TRUNCWORDS_COUNT')
context['languages'] = settings.LANGUAGES
context['current_language'] = get_language()
return context
def get_paginate_by(self, queryset):