From 9046c24c4f99ec1b23f717f81ab0f42650289446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Sun, 15 Jul 2018 03:17:54 +0300 Subject: Language selector function --- setup.py | 3 ++- weblog/static/weblog/js/weblog.js | 2 +- weblog/templates/weblog/post.html | 13 +++++++++---- weblog/views.py | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 3880a4e..c0577f9 100755 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python import os from setuptools import find_packages, setup @@ -9,7 +10,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-weblog', - version='0.3-postlang.2', + version='0.3-postlang.6', packages=find_packages(), include_package_data=True, license='BSD License', diff --git a/weblog/static/weblog/js/weblog.js b/weblog/static/weblog/js/weblog.js index b802841..164cc3b 100755 --- a/weblog/static/weblog/js/weblog.js +++ b/weblog/static/weblog/js/weblog.js @@ -10,4 +10,4 @@ function toggleNode(caller){ $(caller).attr('node-state', 'closed'); } $('#'+target).toggle(); -} \ No newline at end of file +} diff --git a/weblog/templates/weblog/post.html b/weblog/templates/weblog/post.html index 5a389f8..0459744 100755 --- a/weblog/templates/weblog/post.html +++ b/weblog/templates/weblog/post.html @@ -5,13 +5,13 @@

{% if post_translation %}{{ post_translation.title }}{% else %}{{ post.title }}{% endif %}

{% blocktrans with publish_date=post.publish_date %}Published on {{ publish_date }}{% endblocktrans %}{% if post_author %}{% blocktrans with author=post_author context 'Written by (Author)' %}, by {{ author }}{% endblocktrans %}{% endif %}

- {% if languages %} + {% if post_languages %}
- - + {% for lang in post_languages %} - + {% endfor %}
@@ -76,5 +76,10 @@ {% endif %} {% endif %}
+ {% endblock %} diff --git a/weblog/views.py b/weblog/views.py index 922e8c5..95558fc 100755 --- a/weblog/views.py +++ b/weblog/views.py @@ -159,6 +159,7 @@ def PostView(request, category_slug, post_slug, language=None): post = get_object_or_404(BlogPost, slug=post_slug) context_dict = blog_settings.copy() context_dict['comment_form'] = PostCommentForm() + context_dict['post_url'] = post.get_absolute_url() post_translations = Translation.objects.filter(post=post) category = None current_language = translation.get_language() -- cgit v1.2.3