Prevent raising error in case of parent page url_path does not exists

This commit is contained in:
Rui Manuel da Silva Martins 2015-05-25 18:12:35 +01:00
parent 2c7dd89f98
commit b1076b66a1

View file

@ -239,6 +239,11 @@ class TranslationMixin(object):
tr_slug = getattr(self, 'slug_'+settings.LANGUAGE_CODE)
parent_url_path = getattr(parent, 'url_path_'+lang[0])
if not parent_url_path:
parent_url_path = getattr(parent, 'url_path')
setattr(self, 'url_path_'+lang[0], parent_url_path + tr_slug + '/')
else:
# a page without a parent is the tree root,