prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Changing the Organisation Details is not possible
  **URL:** 
  https://opin.me/en/dashboard/organisations/liquid-democracy/settings/
  **user:** 
  Initiators, who try to fill in the Organisations details & as an admin too.
  **expected behaviour:** 
  If I fill in Organisation details, save them and it is there
  **behaviour:** 
  I fill in the Organisation details, press save and it reloads, but do not save.
  **important screensize:**
  
  **device & browser:** 
  Firefox 73.0.1 (64-Bit)
  **Comment/Question:** 
  
  Screenshot?
  
  
  </issue>
  <code>
  [start of euth/dashboard/forms.py]
  1 
  2 import parler
  3 from django import forms
  4 from django.conf import settings
  5 from django.core.exceptions import ValidationError
  6 from django.utils.translation import ugettext_lazy as _
  7 
  8 from euth.organisations.models import Organisation
  9 
  10 
  11 class OrganisationForm(forms.ModelForm):
  12     translated_fields = [
  13         ('description_why', forms.CharField, {
  14             'label': _('description why'),
  15             'widget': forms.Textarea,
  16         }),
  17         ('description_how', forms.CharField, {
  18             'widget': forms.Textarea,
  19             'label': _('description how')
  20         }),
  21         ('description', forms.CharField, {
  22             'label': _('description'),
  23             'help_text': _(
  24                 'More info about the organisation / '
  25                 'Short text for organisation overview'),
  26             'widget': forms.Textarea,
  27         })
  28     ]
  29     languages = [lang_code for lang_code, lang in settings.LANGUAGES]
  30 
  31     class Meta:
  32         model = Organisation
  33         fields = [
  34             'name', 'image', 'logo', 'twitter_handle', 'facebook_handle',
  35             'instagram_handle', 'webpage', 'country', 'place'
  36         ]
  37         help_texts = {
  38             'name': _('The title of your organisation'),
  39         }
  40 
  41     def _get_identifier(self, language, fieldname):
  42         return '{}__{}'.format(language, fieldname)
  43 
  44     def __init__(self, *args, **kwargs):
  45         super().__init__(*args, **kwargs)
  46 
  47         # inject additional form fields for translated model fields
  48         for lang_code in self.languages:
  49             for name, field_cls, kwargs in self.translated_fields:
  50                 self.instance.set_current_language(lang_code)
  51                 field = field_cls(**kwargs)
  52                 identifier = self._get_identifier(
  53                     lang_code, name)
  54                 field.required = False
  55 
  56                 try:
  57                     translation = self.instance.get_translation(lang_code)
  58                     initial = getattr(translation, name)
  59                 except parler.models.TranslationDoesNotExist:
  60                     initial = ''
  61 
  62                 field.initial = initial
  63                 self.fields[identifier] = field
  64 
  65     def translated(self):
  66         """
  67         Return translated fields as list of tuples (language code, fields).
  68         """
  69 
  70         from itertools import groupby
  71         fields = [(field.html_name.split('__')[0], field) for field in self
  72                   if '__' in field.html_name]
  73         groups = groupby(fields, lambda x: x[0])
  74         values = [(lang, list(map(lambda x: x[1], group)))
  75                   for lang, group in groups]
  76         return values
  77 
  78     def untranslated(self):
  79         """
  80         Return untranslated fields as flat list.
  81         """
  82         return [field for field in self if '__' not in field.html_name]
  83 
  84     def prefiled_languages(self):
  85         """
  86         Return languages tabs that need to be displayed.
  87         """
  88         languages = [lang for lang in self.languages
  89                      if lang in self.data
  90                      or self.instance.has_translation(lang)]
  91         # always provide english
  92         if 'en' not in languages:
  93             languages.insert(0, 'en')
  94         return languages
  95 
  96     def save(self, commit=True):
  97         instance = super().save(commit=commit)
  98         if commit is True:
  99             for lang_code in self.languages:
  100                 if lang_code in self.data:
  101                     instance.set_current_language(lang_code)
  102                     for fieldname, _cls, _kwargs in self.translated_fields:
  103                         identifier = '{}__{}'.format(lang_code, fieldname)
  104                         setattr(instance, fieldname,
  105                                 self.cleaned_data.get(identifier))
  106                     instance.save()
  107                 elif instance.has_translation(lang_code):
  108                     instance.delete_translation(lang_code)
  109         return instance
  110 
  111     def clean(self):
  112         for lang_code in self.languages:
  113             if lang_code in self.data:
  114                 for fieldname in self.translated_fields:
  115                     identifier = self._get_identifier(lang_code, fieldname[0])
  116                     data = self.cleaned_data
  117                     if identifier not in data or not data[identifier]:
  118                         msg = 'This field is required'
  119                         raise ValidationError((identifier, msg))
  120 
  121         return self.cleaned_data
  122
  [end of euth/dashboard/forms.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/euth/dashboard/forms.py b/euth/dashboard/forms.py
  --- a/euth/dashboard/forms.py
  +++ b/euth/dashboard/forms.py
  @@ -81,7 +81,7 @@
           """
           return [field for field in self if '__' not in field.html_name]
   
  -    def prefiled_languages(self):
  +    def prefilled_languages(self):
           """
           Return languages tabs that need to be displayed.
           """
  
verification_info: {"golden_diff": "diff --git a/euth/dashboard/forms.py b/euth/dashboard/forms.py\n--- a/euth/dashboard/forms.py\n+++ b/euth/dashboard/forms.py\n@@ -81,7 +81,7 @@\n         \"\"\"\n         return [field for field in self if '__' not in field.html_name]\n \n-    def prefiled_languages(self):\n+    def prefilled_languages(self):\n         \"\"\"\n         Return languages tabs that need to be displayed.\n         \"\"\"\n", "issue": "Changing the Organisation Details is not possible\n**URL:** \r\nhttps://opin.me/en/dashboard/organisations/liquid-democracy/settings/\r\n**user:** \r\nInitiators, who try to fill in the Organisations details & as an admin too.\r\n**expected behaviour:** \r\nIf I fill in Organisation details, save them and it is there\r\n**behaviour:** \r\nI fill in the Organisation details, press save and it reloads, but do not save.\r\n**important screensize:**\r\n\r\n**device & browser:** \r\nFirefox 73.0.1 (64-Bit)\r\n**Comment/Question:** \r\n\r\nScreenshot?\r\n\n", "before_files": [{"content": "\nimport parler\nfrom django import forms\nfrom django.conf import settings\nfrom django.core.exceptions import ValidationError\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom euth.organisations.models import Organisation\n\n\nclass OrganisationForm(forms.ModelForm):\n    translated_fields = [\n        ('description_why', forms.CharField, {\n            'label': _('description why'),\n            'widget': forms.Textarea,\n        }),\n        ('description_how', forms.CharField, {\n            'widget': forms.Textarea,\n            'label': _('description how')\n        }),\n        ('description', forms.CharField, {\n            'label': _('description'),\n            'help_text': _(\n                'More info about the organisation / '\n                'Short text for organisation overview'),\n            'widget': forms.Textarea,\n        })\n    ]\n    languages = [lang_code for lang_code, lang in settings.LANGUAGES]\n\n    class Meta:\n        model = Organisation\n        fields = [\n            'name', 'image', 'logo', 'twitter_handle', 'facebook_handle',\n            'instagram_handle', 'webpage', 'country', 'place'\n        ]\n        help_texts = {\n            'name': _('The title of your organisation'),\n        }\n\n    def _get_identifier(self, language, fieldname):\n        return '{}__{}'.format(language, fieldname)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        # inject additional form fields for translated model fields\n        for lang_code in self.languages:\n            for name, field_cls, kwargs in self.translated_fields:\n                self.instance.set_current_language(lang_code)\n                field = field_cls(**kwargs)\n                identifier = self._get_identifier(\n                    lang_code, name)\n                field.required = False\n\n                try:\n                    translation = self.instance.get_translation(lang_code)\n                    initial = getattr(translation, name)\n                except parler.models.TranslationDoesNotExist:\n                    initial = ''\n\n                field.initial = initial\n                self.fields[identifier] = field\n\n    def translated(self):\n        \"\"\"\n        Return translated fields as list of tuples (language code, fields).\n        \"\"\"\n\n        from itertools import groupby\n        fields = [(field.html_name.split('__')[0], field) for field in self\n                  if '__' in field.html_name]\n        groups = groupby(fields, lambda x: x[0])\n        values = [(lang, list(map(lambda x: x[1], group)))\n                  for lang, group in groups]\n        return values\n\n    def untranslated(self):\n        \"\"\"\n        Return untranslated fields as flat list.\n        \"\"\"\n        return [field for field in self if '__' not in field.html_name]\n\n    def prefiled_languages(self):\n        \"\"\"\n        Return languages tabs that need to be displayed.\n        \"\"\"\n        languages = [lang for lang in self.languages\n                     if lang in self.data\n                     or self.instance.has_translation(lang)]\n        # always provide english\n        if 'en' not in languages:\n            languages.insert(0, 'en')\n        return languages\n\n    def save(self, commit=True):\n        instance = super().save(commit=commit)\n        if commit is True:\n            for lang_code in self.languages:\n                if lang_code in self.data:\n                    instance.set_current_language(lang_code)\n                    for fieldname, _cls, _kwargs in self.translated_fields:\n                        identifier = '{}__{}'.format(lang_code, fieldname)\n                        setattr(instance, fieldname,\n                                self.cleaned_data.get(identifier))\n                    instance.save()\n                elif instance.has_translation(lang_code):\n                    instance.delete_translation(lang_code)\n        return instance\n\n    def clean(self):\n        for lang_code in self.languages:\n            if lang_code in self.data:\n                for fieldname in self.translated_fields:\n                    identifier = self._get_identifier(lang_code, fieldname[0])\n                    data = self.cleaned_data\n                    if identifier not in data or not data[identifier]:\n                        msg = 'This field is required'\n                        raise ValidationError((identifier, msg))\n\n        return self.cleaned_data\n", "path": "euth/dashboard/forms.py"}]}