prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Duplicate choices in shipping address
  ### What I'm trying to achieve
  I'm trying to set shipping user for Russian user and there are duplicate values in "Oblast" selector.
  
  ### Steps to reproduce the problem
  1. Create new shipping address
  2. Country --> Russia
  3. There are duplicated values in "Oblast" selector
  
  ### What I expected to happen
  There are no duplicated values in "Oblast" selector
  
  ### Screenshots
  What happens now
  <img src="https://user-images.githubusercontent.com/13136992/53255369-8a239600-36d6-11e9-84a6-24a10b96a321.png" width="300">
  
  
  What I expect to see
  <img src="https://user-images.githubusercontent.com/13136992/53255400-99a2df00-36d6-11e9-8913-ecaec174487a.png" width="300">
  
  
  **System information**
  Operating system: Manjaro Linux
  Browser: Google Chrome 72.0.3626.81
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `saleor/account/forms.py`
  Content:
  ```
  1 from captcha.fields import ReCaptchaField
  2 from django import forms
  3 from django.conf import settings
  4 from django.contrib.auth import forms as django_forms, update_session_auth_hash
  5 from django.utils.translation import pgettext, pgettext_lazy
  6 from phonenumbers.phonenumberutil import country_code_for_region
  7 
  8 from ..account.models import User
  9 from . import emails
  10 from .i18n import AddressMetaForm, get_address_form_class
  11 
  12 
  13 class FormWithReCaptcha(forms.BaseForm):
  14     def __new__(cls, *args, **kwargs):
  15         if settings.RECAPTCHA_PUBLIC_KEY and settings.RECAPTCHA_PRIVATE_KEY:
  16             # insert a Google reCaptcha field inside the form
  17             # note: label is empty, the reCaptcha is self-explanatory making
  18             #       the form simpler for the user.
  19             cls.base_fields['_captcha'] = ReCaptchaField(label='')
  20         return super(FormWithReCaptcha, cls).__new__(cls)
  21 
  22 
  23 def get_address_form(
  24         data, country_code, initial=None, instance=None, **kwargs):
  25     country_form = AddressMetaForm(data, initial=initial)
  26     preview = False
  27     if country_form.is_valid():
  28         country_code = country_form.cleaned_data['country']
  29         preview = country_form.cleaned_data['preview']
  30 
  31     if initial is None and country_code:
  32         initial = {}
  33     if country_code:
  34         initial['phone'] = '+{}'.format(country_code_for_region(country_code))
  35 
  36     address_form_class = get_address_form_class(country_code)
  37 
  38     if not preview and instance is not None:
  39         address_form_class = get_address_form_class(instance.country.code)
  40         address_form = address_form_class(data, instance=instance, **kwargs)
  41     else:
  42         initial_address = (
  43             initial if not preview
  44             else data.dict() if data is not None else data)
  45         address_form = address_form_class(
  46             not preview and data or None,
  47             initial=initial_address,
  48             **kwargs)
  49     return address_form, preview
  50 
  51 
  52 class ChangePasswordForm(django_forms.PasswordChangeForm):
  53     def __init__(self, *args, **kwargs):
  54         super().__init__(*args, **kwargs)
  55         self.fields['new_password1'].user = self.user
  56         self.fields['old_password'].widget.attrs['placeholder'] = ''
  57         self.fields['new_password1'].widget.attrs['placeholder'] = ''
  58         del self.fields['new_password2']
  59 
  60 
  61 def logout_on_password_change(request, user):
  62     if (update_session_auth_hash is not None and
  63             not settings.LOGOUT_ON_PASSWORD_CHANGE):
  64         update_session_auth_hash(request, user)
  65 
  66 
  67 class LoginForm(django_forms.AuthenticationForm, FormWithReCaptcha):
  68     username = forms.EmailField(
  69         label=pgettext('Form field', 'Email'), max_length=75)
  70 
  71     def __init__(self, request=None, *args, **kwargs):
  72         super().__init__(request=request, *args, **kwargs)
  73         if request:
  74             email = request.GET.get('email')
  75             if email:
  76                 self.fields['username'].initial = email
  77 
  78 
  79 class SignupForm(forms.ModelForm, FormWithReCaptcha):
  80     password = forms.CharField(
  81         widget=forms.PasswordInput,
  82         label=pgettext('Password', 'Password'))
  83     email = forms.EmailField(
  84         label=pgettext('Email', 'Email'),
  85         error_messages={
  86             'unique': pgettext_lazy(
  87                 'Registration error',
  88                 'This email has already been registered.')})
  89 
  90     class Meta:
  91         model = User
  92         fields = ('email',)
  93 
  94     def __init__(self, *args, **kwargs):
  95         super().__init__(*args, **kwargs)
  96         if self._meta.model.USERNAME_FIELD in self.fields:
  97             self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update(
  98                 {'autofocus': ''})
  99 
  100     def save(self, request=None, commit=True):
  101         user = super().save(commit=False)
  102         password = self.cleaned_data['password']
  103         user.set_password(password)
  104         if commit:
  105             user.save()
  106         return user
  107 
  108 
  109 class PasswordResetForm(django_forms.PasswordResetForm, FormWithReCaptcha):
  110     """Allow resetting passwords.
  111 
  112     This subclass overrides sending emails to use templated email.
  113     """
  114 
  115     def get_users(self, email):
  116         active_users = User.objects.filter(email__iexact=email, is_active=True)
  117         return active_users
  118 
  119     def send_mail(
  120             self, subject_template_name, email_template_name, context,
  121             from_email, to_email, html_email_template_name=None):
  122         # Passing the user object to the Celery task throws an
  123         # error "'User' is not JSON serializable". Since it's not used in our
  124         # template, we remove it from the context.
  125         del context['user']
  126         emails.send_password_reset_email.delay(context, to_email)
  127 
  128 
  129 class NameForm(forms.ModelForm):
  130     class Meta:
  131         model = User
  132         fields = ['first_name', 'last_name']
  133         labels = {
  134             'first_name': pgettext_lazy(
  135                 'Customer form: Given name field', 'Given name'),
  136             'last_name': pgettext_lazy(
  137                 'Customer form: Family name field', 'Family name')}
  138
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/saleor/account/forms.py b/saleor/account/forms.py
  --- a/saleor/account/forms.py
  +++ b/saleor/account/forms.py
  @@ -46,6 +46,11 @@
               not preview and data or None,
               initial=initial_address,
               **kwargs)
  +
  +    if hasattr(address_form.fields['country_area'], 'choices'):
  +        choices = address_form.fields['country_area'].choices
  +        choices = [(choice[1], choice[1]) for choice in choices]
  +        address_form.fields['country_area'].choices = choices
       return address_form, preview
  
verification_info: {"golden_diff": "diff --git a/saleor/account/forms.py b/saleor/account/forms.py\n--- a/saleor/account/forms.py\n+++ b/saleor/account/forms.py\n@@ -46,6 +46,11 @@\n             not preview and data or None,\n             initial=initial_address,\n             **kwargs)\n+\n+    if hasattr(address_form.fields['country_area'], 'choices'):\n+        choices = address_form.fields['country_area'].choices\n+        choices = [(choice[1], choice[1]) for choice in choices]\n+        address_form.fields['country_area'].choices = choices\n     return address_form, preview\n", "issue": "Duplicate choices in shipping address\n### What I'm trying to achieve\r\nI'm trying to set shipping user for Russian user and there are duplicate values in \"Oblast\" selector.\r\n\r\n### Steps to reproduce the problem\r\n1. Create new shipping address\r\n2. Country --> Russia\r\n3. There are duplicated values in \"Oblast\" selector\r\n\r\n### What I expected to happen\r\nThere are no duplicated values in \"Oblast\" selector\r\n\r\n### Screenshots\r\nWhat happens now\r\n<img src=\"https://user-images.githubusercontent.com/13136992/53255369-8a239600-36d6-11e9-84a6-24a10b96a321.png\" width=\"300\">\r\n\r\n\r\nWhat I expect to see\r\n<img src=\"https://user-images.githubusercontent.com/13136992/53255400-99a2df00-36d6-11e9-8913-ecaec174487a.png\" width=\"300\">\r\n\r\n\r\n**System information**\r\nOperating system: Manjaro Linux\r\nBrowser: Google Chrome 72.0.3626.81\r\n\n", "before_files": [{"content": "from captcha.fields import ReCaptchaField\nfrom django import forms\nfrom django.conf import settings\nfrom django.contrib.auth import forms as django_forms, update_session_auth_hash\nfrom django.utils.translation import pgettext, pgettext_lazy\nfrom phonenumbers.phonenumberutil import country_code_for_region\n\nfrom ..account.models import User\nfrom . import emails\nfrom .i18n import AddressMetaForm, get_address_form_class\n\n\nclass FormWithReCaptcha(forms.BaseForm):\n    def __new__(cls, *args, **kwargs):\n        if settings.RECAPTCHA_PUBLIC_KEY and settings.RECAPTCHA_PRIVATE_KEY:\n            # insert a Google reCaptcha field inside the form\n            # note: label is empty, the reCaptcha is self-explanatory making\n            #       the form simpler for the user.\n            cls.base_fields['_captcha'] = ReCaptchaField(label='')\n        return super(FormWithReCaptcha, cls).__new__(cls)\n\n\ndef get_address_form(\n        data, country_code, initial=None, instance=None, **kwargs):\n    country_form = AddressMetaForm(data, initial=initial)\n    preview = False\n    if country_form.is_valid():\n        country_code = country_form.cleaned_data['country']\n        preview = country_form.cleaned_data['preview']\n\n    if initial is None and country_code:\n        initial = {}\n    if country_code:\n        initial['phone'] = '+{}'.format(country_code_for_region(country_code))\n\n    address_form_class = get_address_form_class(country_code)\n\n    if not preview and instance is not None:\n        address_form_class = get_address_form_class(instance.country.code)\n        address_form = address_form_class(data, instance=instance, **kwargs)\n    else:\n        initial_address = (\n            initial if not preview\n            else data.dict() if data is not None else data)\n        address_form = address_form_class(\n            not preview and data or None,\n            initial=initial_address,\n            **kwargs)\n    return address_form, preview\n\n\nclass ChangePasswordForm(django_forms.PasswordChangeForm):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.fields['new_password1'].user = self.user\n        self.fields['old_password'].widget.attrs['placeholder'] = ''\n        self.fields['new_password1'].widget.attrs['placeholder'] = ''\n        del self.fields['new_password2']\n\n\ndef logout_on_password_change(request, user):\n    if (update_session_auth_hash is not None and\n            not settings.LOGOUT_ON_PASSWORD_CHANGE):\n        update_session_auth_hash(request, user)\n\n\nclass LoginForm(django_forms.AuthenticationForm, FormWithReCaptcha):\n    username = forms.EmailField(\n        label=pgettext('Form field', 'Email'), max_length=75)\n\n    def __init__(self, request=None, *args, **kwargs):\n        super().__init__(request=request, *args, **kwargs)\n        if request:\n            email = request.GET.get('email')\n            if email:\n                self.fields['username'].initial = email\n\n\nclass SignupForm(forms.ModelForm, FormWithReCaptcha):\n    password = forms.CharField(\n        widget=forms.PasswordInput,\n        label=pgettext('Password', 'Password'))\n    email = forms.EmailField(\n        label=pgettext('Email', 'Email'),\n        error_messages={\n            'unique': pgettext_lazy(\n                'Registration error',\n                'This email has already been registered.')})\n\n    class Meta:\n        model = User\n        fields = ('email',)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self._meta.model.USERNAME_FIELD in self.fields:\n            self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update(\n                {'autofocus': ''})\n\n    def save(self, request=None, commit=True):\n        user = super().save(commit=False)\n        password = self.cleaned_data['password']\n        user.set_password(password)\n        if commit:\n            user.save()\n        return user\n\n\nclass PasswordResetForm(django_forms.PasswordResetForm, FormWithReCaptcha):\n    \"\"\"Allow resetting passwords.\n\n    This subclass overrides sending emails to use templated email.\n    \"\"\"\n\n    def get_users(self, email):\n        active_users = User.objects.filter(email__iexact=email, is_active=True)\n        return active_users\n\n    def send_mail(\n            self, subject_template_name, email_template_name, context,\n            from_email, to_email, html_email_template_name=None):\n        # Passing the user object to the Celery task throws an\n        # error \"'User' is not JSON serializable\". Since it's not used in our\n        # template, we remove it from the context.\n        del context['user']\n        emails.send_password_reset_email.delay(context, to_email)\n\n\nclass NameForm(forms.ModelForm):\n    class Meta:\n        model = User\n        fields = ['first_name', 'last_name']\n        labels = {\n            'first_name': pgettext_lazy(\n                'Customer form: Given name field', 'Given name'),\n            'last_name': pgettext_lazy(\n                'Customer form: Family name field', 'Family name')}\n", "path": "saleor/account/forms.py"}], "after_files": [{"content": "from captcha.fields import ReCaptchaField\nfrom django import forms\nfrom django.conf import settings\nfrom django.contrib.auth import forms as django_forms, update_session_auth_hash\nfrom django.utils.translation import pgettext, pgettext_lazy\nfrom phonenumbers.phonenumberutil import country_code_for_region\n\nfrom ..account.models import User\nfrom . import emails\nfrom .i18n import AddressMetaForm, get_address_form_class\n\n\nclass FormWithReCaptcha(forms.BaseForm):\n    def __new__(cls, *args, **kwargs):\n        if settings.RECAPTCHA_PUBLIC_KEY and settings.RECAPTCHA_PRIVATE_KEY:\n            # insert a Google reCaptcha field inside the form\n            # note: label is empty, the reCaptcha is self-explanatory making\n            #       the form simpler for the user.\n            cls.base_fields['_captcha'] = ReCaptchaField(label='')\n        return super(FormWithReCaptcha, cls).__new__(cls)\n\n\ndef get_address_form(\n        data, country_code, initial=None, instance=None, **kwargs):\n    country_form = AddressMetaForm(data, initial=initial)\n    preview = False\n    if country_form.is_valid():\n        country_code = country_form.cleaned_data['country']\n        preview = country_form.cleaned_data['preview']\n\n    if initial is None and country_code:\n        initial = {}\n    if country_code:\n        initial['phone'] = '+{}'.format(country_code_for_region(country_code))\n\n    address_form_class = get_address_form_class(country_code)\n\n    if not preview and instance is not None:\n        address_form_class = get_address_form_class(instance.country.code)\n        address_form = address_form_class(data, instance=instance, **kwargs)\n    else:\n        initial_address = (\n            initial if not preview\n            else data.dict() if data is not None else data)\n        address_form = address_form_class(\n            not preview and data or None,\n            initial=initial_address,\n            **kwargs)\n\n    if hasattr(address_form.fields['country_area'], 'choices'):\n        choices = address_form.fields['country_area'].choices\n        choices = [(choice[1], choice[1]) for choice in choices]\n        address_form.fields['country_area'].choices = choices\n    return address_form, preview\n\n\nclass ChangePasswordForm(django_forms.PasswordChangeForm):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.fields['new_password1'].user = self.user\n        self.fields['old_password'].widget.attrs['placeholder'] = ''\n        self.fields['new_password1'].widget.attrs['placeholder'] = ''\n        del self.fields['new_password2']\n\n\ndef logout_on_password_change(request, user):\n    if (update_session_auth_hash is not None and\n            not settings.LOGOUT_ON_PASSWORD_CHANGE):\n        update_session_auth_hash(request, user)\n\n\nclass LoginForm(django_forms.AuthenticationForm, FormWithReCaptcha):\n    username = forms.EmailField(\n        label=pgettext('Form field', 'Email'), max_length=75)\n\n    def __init__(self, request=None, *args, **kwargs):\n        super().__init__(request=request, *args, **kwargs)\n        if request:\n            email = request.GET.get('email')\n            if email:\n                self.fields['username'].initial = email\n\n\nclass SignupForm(forms.ModelForm, FormWithReCaptcha):\n    password = forms.CharField(\n        widget=forms.PasswordInput,\n        label=pgettext('Password', 'Password'))\n    email = forms.EmailField(\n        label=pgettext('Email', 'Email'),\n        error_messages={\n            'unique': pgettext_lazy(\n                'Registration error',\n                'This email has already been registered.')})\n\n    class Meta:\n        model = User\n        fields = ('email',)\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        if self._meta.model.USERNAME_FIELD in self.fields:\n            self.fields[self._meta.model.USERNAME_FIELD].widget.attrs.update(\n                {'autofocus': ''})\n\n    def save(self, request=None, commit=True):\n        user = super().save(commit=False)\n        password = self.cleaned_data['password']\n        user.set_password(password)\n        if commit:\n            user.save()\n        return user\n\n\nclass PasswordResetForm(django_forms.PasswordResetForm, FormWithReCaptcha):\n    \"\"\"Allow resetting passwords.\n\n    This subclass overrides sending emails to use templated email.\n    \"\"\"\n\n    def get_users(self, email):\n        active_users = User.objects.filter(email__iexact=email, is_active=True)\n        return active_users\n\n    def send_mail(\n            self, subject_template_name, email_template_name, context,\n            from_email, to_email, html_email_template_name=None):\n        # Passing the user object to the Celery task throws an\n        # error \"'User' is not JSON serializable\". Since it's not used in our\n        # template, we remove it from the context.\n        del context['user']\n        emails.send_password_reset_email.delay(context, to_email)\n\n\nclass NameForm(forms.ModelForm):\n    class Meta:\n        model = User\n        fields = ['first_name', 'last_name']\n        labels = {\n            'first_name': pgettext_lazy(\n                'Customer form: Given name field', 'Given name'),\n            'last_name': pgettext_lazy(\n                'Customer form: Family name field', 'Family name')}\n", "path": "saleor/account/forms.py"}]}