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

Bugfix

parent 8dafdfa6
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,8 @@ class InformationLocale(models.Model): ...@@ -20,6 +20,8 @@ class InformationLocale(models.Model):
@staticmethod @staticmethod
def get_information_locale_with_fallback(information_id, language_code=translation.get_language()): 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 with user's preferred locale first
try: try:
return InformationLocale.objects.get( return InformationLocale.objects.get(
...@@ -42,7 +44,9 @@ class InformationLocale(models.Model): ...@@ -42,7 +44,9 @@ class InformationLocale(models.Model):
) )
except: except:
# Use the first and best # Use the first and best
return InformationLocale.objects.all()[0] return InformationLocale.objects.get(
information=Information.objects.get(pk=information_id)
)[0]
@staticmethod @staticmethod
def get_heading_with_fallback(information_id, language_code=translation.get_language()): 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