Merge remote-tracking branch 'origin/release/0.8.x' into develop
This commit is contained in:
commit
b0434773fa
7 changed files with 27 additions and 8 deletions
|
@ -21,6 +21,12 @@ History
|
|||
* Dropped strict dependency on aldryn-search, haystack. Install separately for search support.
|
||||
* Improved admin filtering.
|
||||
|
||||
*******************
|
||||
0.8.10 (2017-01-02)
|
||||
*******************
|
||||
|
||||
* Fix error in get_absolute_url
|
||||
|
||||
******************
|
||||
0.8.9 (2016-10-25)
|
||||
******************
|
||||
|
|
|
@ -7,7 +7,8 @@ import os
|
|||
from tempfile import mkdtemp
|
||||
|
||||
|
||||
def gettext(s): return s
|
||||
def gettext(s):
|
||||
return s
|
||||
|
||||
|
||||
HELPER_SETTINGS = dict(
|
||||
|
|
|
@ -3,6 +3,6 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
|
||||
__author__ = 'Iacopo Spalletti'
|
||||
__email__ = 'i.spalletti@nephila.it'
|
||||
__version__ = '0.9b5'
|
||||
__version__ = '0.9b6'
|
||||
|
||||
default_app_config = 'djangocms_blog.apps.BlogAppConfig'
|
||||
|
|
|
@ -11,6 +11,7 @@ from .cms_menus import BlogCategoryMenu
|
|||
from .settings import get_setting
|
||||
|
||||
|
||||
@apphook_pool.register
|
||||
class BlogApp(AutoCMSAppMixin, CMSConfigApp):
|
||||
name = _('Blog')
|
||||
urls = ['djangocms_blog.urls']
|
||||
|
@ -30,5 +31,4 @@ class BlogApp(AutoCMSAppMixin, CMSConfigApp):
|
|||
}
|
||||
|
||||
|
||||
apphook_pool.register(BlogApp)
|
||||
BlogApp.setup()
|
||||
|
|
|
@ -107,9 +107,6 @@ class BlogCategoryMenu(CMSAttachMenu):
|
|||
return nodes
|
||||
|
||||
|
||||
menu_pool.register_menu(BlogCategoryMenu)
|
||||
|
||||
|
||||
class BlogNavModifier(Modifier):
|
||||
"""
|
||||
This navigation modifier makes sure that when
|
||||
|
@ -164,6 +161,7 @@ class BlogNavModifier(Modifier):
|
|||
|
||||
|
||||
menu_pool.register_modifier(BlogNavModifier)
|
||||
menu_pool.register_menu(BlogCategoryMenu)
|
||||
|
||||
|
||||
def clear_menu_cache(**kwargs):
|
||||
|
|
|
@ -256,10 +256,10 @@ class Post(KnockerModel, ModelMeta, TranslatableModel):
|
|||
super(Post, self).save_translation(translation, *args, **kwargs)
|
||||
|
||||
def get_absolute_url(self, lang=None):
|
||||
if not lang or lang not in self.get_available_languages():
|
||||
lang = self.get_current_language()
|
||||
if not lang or lang not in self.get_available_languages():
|
||||
lang = get_language()
|
||||
if not lang or lang not in self.get_available_languages():
|
||||
lang = self.get_current_language()
|
||||
with switch_language(self, lang):
|
||||
category = self.categories.first()
|
||||
kwargs = {}
|
||||
|
|
|
@ -717,6 +717,20 @@ class ModelsTest(BaseTest):
|
|||
post.app_config = self.app_config_1
|
||||
self.assertTrue(re.match(r'.*/%s/$' % post.slug, post.get_absolute_url()))
|
||||
|
||||
def test_url_language(self):
|
||||
self.get_pages()
|
||||
post = self._get_post(self._post_data[0]['en'])
|
||||
post = self._get_post(self._post_data[0]['it'], post, 'it')
|
||||
|
||||
with override('it'):
|
||||
self.assertEqual(post.get_current_language(), 'en')
|
||||
self.assertEqual(post.get_absolute_url(), post.get_absolute_url('it'))
|
||||
|
||||
post.set_current_language('it')
|
||||
with override('en'):
|
||||
self.assertEqual(post.get_current_language(), 'it')
|
||||
self.assertEqual(post.get_absolute_url(), post.get_absolute_url('en'))
|
||||
|
||||
def test_manager(self):
|
||||
self.get_pages()
|
||||
post1 = self._get_post(self._post_data[0]['en'])
|
||||
|
|
Loading…
Reference in a new issue