Quickfix for navbar export

This commit is contained in:
Rodolphe Breard 2020-02-06 12:39:44 +01:00
parent 63c5d10911
commit 598c4ab59d
2 changed files with 5 additions and 2 deletions

View file

@ -39,7 +39,7 @@ class Element(models.Model):
def localized_link(self): def localized_link(self):
link = self.link link = self.link
desc = self.description() desc = self.description()
if desc.link_override: if desc and desc.link_override:
link = desc.link_override link = desc.link_override
return link return link

View file

@ -25,6 +25,9 @@ def get_lang_data(path_info, lang_code, curr_lang):
lang_name = get_lang_name(lang_code) lang_name = get_lang_name(lang_code)
rm = resolve(path_info) rm = resolve(path_info)
activate_lang(lang_code) activate_lang(lang_code)
if path_info == "/":
lang_url = f"/{lang_code}/"
else:
lang_url = reverse(rm.view_name, current_app="npb", args=rm.args, kwargs=rm.kwargs) lang_url = reverse(rm.view_name, current_app="npb", args=rm.args, kwargs=rm.kwargs)
activate_lang(curr_lang) activate_lang(curr_lang)
return (lang_code, lang_name, lang_url) return (lang_code, lang_name, lang_url)