prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Manual creation of Languages results in Bugsplash at page view.
  ### Describe the Bug
  If a system is set up manually without the test data. The manual language setup results in a error when opening the list view of the pages.
  ![grafik](https://user-images.githubusercontent.com/15608678/87561440-fc768b00-c6bc-11ea-8853-6207ba1d4b5b.png)
  
  
  
  ### Steps to Reproduce
  
  1. Create Languages (Like German with code DE_de)
  2. Create Region (Like Berlin)
  3. Add Language Tree model like German -> English
  4. Click on Pages and see error
  
  ### Expected Behavior
  The usual list should be displayed. 
  
  
  ### Actual Behavior
  Error message from Django.
  
  
  ### Additional Information
  I guess this has something to do with manually setting the language code and this can't be matched by django.
  
  
  Manual creation of Languages results in Bugsplash at page view.
  ### Describe the Bug
  If a system is set up manually without the test data. The manual language setup results in a error when opening the list view of the pages.
  ![grafik](https://user-images.githubusercontent.com/15608678/87561440-fc768b00-c6bc-11ea-8853-6207ba1d4b5b.png)
  
  
  
  ### Steps to Reproduce
  
  1. Create Languages (Like German with code DE_de)
  2. Create Region (Like Berlin)
  3. Add Language Tree model like German -> English
  4. Click on Pages and see error
  
  ### Expected Behavior
  The usual list should be displayed. 
  
  
  ### Actual Behavior
  Error message from Django.
  
  
  ### Additional Information
  I guess this has something to do with manually setting the language code and this can't be matched by django.
  
  
  
  </issue>
  <code>
  [start of src/cms/templatetags/content_filters.py]
  1 import logging
  2 
  3 from django import template
  4 
  5 from ..models import Language
  6 
  7 logger = logging.getLogger(__name__)
  8 register = template.Library()
  9 
  10 
  11 @register.simple_tag
  12 def get_translation(instance, language_code):
  13     return instance.translations.filter(language__code=language_code).first()
  14 
  15 
  16 @register.simple_tag
  17 def translated_language_name(language_code):
  18     return Language.objects.get(code=language_code).translated_name
  19 
  20 @register.simple_tag
  21 def get_language(language_code):
  22     return Language.objects.get(code=language_code)
  23 
  24 # Unify the language codes of backend and content languages
  25 @register.simple_tag
  26 def unify_language_code(language_code):
  27     if language_code == 'en-gb':
  28         return 'en-us'
  29     return language_code
  30 
  31 
  32 @register.filter
  33 def get_int_list(data, list_name):
  34     return [int(item) for item in data.getlist(list_name)]
  35 
  36 
  37 @register.filter
  38 def is_empty(iterable):
  39     return not bool(iterable)
  40
  [end of src/cms/templatetags/content_filters.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/cms/templatetags/content_filters.py b/src/cms/templatetags/content_filters.py
  --- a/src/cms/templatetags/content_filters.py
  +++ b/src/cms/templatetags/content_filters.py
  @@ -15,11 +15,14 @@
   
   @register.simple_tag
   def translated_language_name(language_code):
  -    return Language.objects.get(code=language_code).translated_name
  +    language = Language.objects.filter(code=language_code)
  +    if language.exists():
  +        return language.first().translated_name
  +    return ''
   
   @register.simple_tag
   def get_language(language_code):
  -    return Language.objects.get(code=language_code)
  +    return Language.objects.filter(code=language_code).first()
   
   # Unify the language codes of backend and content languages
   @register.simple_tag
  
verification_info: {"golden_diff": "diff --git a/src/cms/templatetags/content_filters.py b/src/cms/templatetags/content_filters.py\n--- a/src/cms/templatetags/content_filters.py\n+++ b/src/cms/templatetags/content_filters.py\n@@ -15,11 +15,14 @@\n \n @register.simple_tag\n def translated_language_name(language_code):\n-    return Language.objects.get(code=language_code).translated_name\n+    language = Language.objects.filter(code=language_code)\n+    if language.exists():\n+        return language.first().translated_name\n+    return ''\n \n @register.simple_tag\n def get_language(language_code):\n-    return Language.objects.get(code=language_code)\n+    return Language.objects.filter(code=language_code).first()\n \n # Unify the language codes of backend and content languages\n @register.simple_tag\n", "issue": "Manual creation of Languages results in Bugsplash at page view.\n### Describe the Bug\r\nIf a system is set up manually without the test data. The manual language setup results in a error when opening the list view of the pages.\r\n![grafik](https://user-images.githubusercontent.com/15608678/87561440-fc768b00-c6bc-11ea-8853-6207ba1d4b5b.png)\r\n\r\n\r\n\r\n### Steps to Reproduce\r\n\r\n1. Create Languages (Like German with code DE_de)\r\n2. Create Region (Like Berlin)\r\n3. Add Language Tree model like German -> English\r\n4. Click on Pages and see error\r\n\r\n### Expected Behavior\r\nThe usual list should be displayed. \r\n\r\n\r\n### Actual Behavior\r\nError message from Django.\r\n\r\n\r\n### Additional Information\r\nI guess this has something to do with manually setting the language code and this can't be matched by django.\r\n\r\n\nManual creation of Languages results in Bugsplash at page view.\n### Describe the Bug\r\nIf a system is set up manually without the test data. The manual language setup results in a error when opening the list view of the pages.\r\n![grafik](https://user-images.githubusercontent.com/15608678/87561440-fc768b00-c6bc-11ea-8853-6207ba1d4b5b.png)\r\n\r\n\r\n\r\n### Steps to Reproduce\r\n\r\n1. Create Languages (Like German with code DE_de)\r\n2. Create Region (Like Berlin)\r\n3. Add Language Tree model like German -> English\r\n4. Click on Pages and see error\r\n\r\n### Expected Behavior\r\nThe usual list should be displayed. \r\n\r\n\r\n### Actual Behavior\r\nError message from Django.\r\n\r\n\r\n### Additional Information\r\nI guess this has something to do with manually setting the language code and this can't be matched by django.\r\n\r\n\n", "before_files": [{"content": "import logging\n\nfrom django import template\n\nfrom ..models import Language\n\nlogger = logging.getLogger(__name__)\nregister = template.Library()\n\n\n@register.simple_tag\ndef get_translation(instance, language_code):\n    return instance.translations.filter(language__code=language_code).first()\n\n\n@register.simple_tag\ndef translated_language_name(language_code):\n    return Language.objects.get(code=language_code).translated_name\n\n@register.simple_tag\ndef get_language(language_code):\n    return Language.objects.get(code=language_code)\n\n# Unify the language codes of backend and content languages\n@register.simple_tag\ndef unify_language_code(language_code):\n    if language_code == 'en-gb':\n        return 'en-us'\n    return language_code\n\n\n@register.filter\ndef get_int_list(data, list_name):\n    return [int(item) for item in data.getlist(list_name)]\n\n\n@register.filter\ndef is_empty(iterable):\n    return not bool(iterable)\n", "path": "src/cms/templatetags/content_filters.py"}]}