Skip to content
Snippets Groups Projects
Commit 3f12e07c authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Bugfix

parent 8dafdfa6
Branches
No related tags found
No related merge requests found
......@@ -20,6 +20,8 @@ class InformationLocale(models.Model):
@staticmethod
def get_information_locale_with_fallback(information_id, language_code=translation.get_language()):
if information_id == None:
return ""
# Try with user's preferred locale first
try:
return InformationLocale.objects.get(
......@@ -42,7 +44,9 @@ class InformationLocale(models.Model):
)
except:
# Use the first and best
return InformationLocale.objects.all()[0]
return InformationLocale.objects.get(
information=Information.objects.get(pk=information_id)
)[0]
@staticmethod
def get_heading_with_fallback(information_id, language_code=translation.get_language()):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment