diff --git a/information/models.py b/information/models.py index 02dbdaa18808ee4a95322c846eef84f5579ce24b..d1133864ee5b295e36b15b6adc82679099793289 100644 --- a/information/models.py +++ b/information/models.py @@ -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()):