Preparing version 0.4.4

This commit is contained in:
Rui Martins 2016-01-07 15:04:19 +00:00
parent eef660747e
commit e59aa99f4b
4 changed files with 18 additions and 9 deletions

View file

@ -1,3 +1,6 @@
v0.4.4:
- Fix issue related to Django 1.9.x
v0.4.3:
- Fixed bug when editing a page and parent url path of some language is None.

View file

@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: wagtail-modeltranslation
Version: 0.4.3
Version: 0.4.4
Summary: Translates Wagtail CMS models using a registration approach.
Home-page: https://github.com/infoportugal/wagtail-modeltranslation
Author: Diogo Marques, Eduardo Nogueira, Rui Martins

View file

@ -4,7 +4,7 @@ from distutils.core import setup
setup(
name='wagtail-modeltranslation',
version='0.4.3',
version='0.4.4',
description='Translates Wagtail CMS models using a registration approach.',
long_description=(
'The modeltranslation application can be used to translate dynamic '

View file

@ -414,11 +414,18 @@ class TranslationMixin(object):
@classmethod
def _patch_inlinepanel(cls, instance, panel):
relation = getattr(instance.__class__, panel.relation_name)
inline_panels = getattr(relation.related.model, 'panels', [])
related_fieldname = 'related'
try:
inline_model_tr_fields = translator.get_options_for_model(
getattr(instance.__class__, panel.relation_name).related.model
).fields
inline_panels = getattr(getattr(relation, related_fieldname).model, 'panels', [])
except AttributeError:
related_fieldname = 'rel'
inline_panels = getattr(getattr(relation, related_fieldname).model, 'panels', [])
try:
model = getattr(getattr(instance.__class__, panel.relation_name), related_fieldname).model
inline_model_tr_fields = translator.get_options_for_model(model).fields
except NotRegistered:
return None
@ -427,8 +434,7 @@ class TranslationMixin(object):
for item in cls._patch_fieldpanel(inlinepanel, inline_model_tr_fields):
translated_inline.append(item)
getattr(instance.__class__, panel.relation_name).related.model.panels =\
translated_inline
model.panels = translated_inline
@transaction.atomic # only commit when all descendants are properly updated
def move(self, target, pos=None):
@ -465,7 +471,7 @@ class TranslationMixin(object):
tr_slug = getattr(self, 'slug_'+settings.LANGUAGE_CODE) if\
hasattr(self, 'slug_'+settings.LANGUAGE_CODE) else\
getattr(self, 'slug')
if hasattr(parent, 'url_path_'+lang[0]) and getattr(parent, 'url_path_'+lang[0]) is not None:
parent_url_path = getattr(parent, 'url_path_'+lang[0])
else: