mirror of
https://github.com/Hopiu/wagtail-modeltranslation.git
synced 2026-05-11 16:53:11 +00:00
Prevent raising error in case of parent page url_path does not exists
This commit is contained in:
parent
2c7dd89f98
commit
b1076b66a1
1 changed files with 5 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue