prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Update profile modal displays to super admin account created with setup wizard 
  ### Observed behavior
  _(Wouldn't even know this might be an issue if I hadn't been reviewing super admin Gherkins all past week :blush:)_
  
  According to the [Gherkin scenario](https://github.com/learningequality/kolibri/blob/release-v0.13.x/integration_testing/features/learner/learner-profile-update-notification.feature#L22), this should not appear:
  
  ![Ubuntu16 04 (start)  Running  - Oracle VM VirtualBox_677](https://user-images.githubusercontent.com/1457929/85937605-68a76f80-b905-11ea-8f75-88ff846fa271.png)
  
  ### Expected behavior
  No profile update modal for the super admin.
  
  ### User-facing consequences
  Annoyed super admin.
  
  ### Errors and logs
  …
  
  ### Steps to reproduce
  1. Install Kolibri
  2. Go through the setup wizard
  3. Go to Learn 
  
  ### Context
   * Kolibri version: 0.14.0b6, DEB installer
   * Operating system: Ubuntu 16.04
   * Browser: both Firefox and Chrome
  
  
  </issue>
  <code>
  [start of kolibri/core/device/utils.py]
  1 """
  2 Do all imports of the device settings model inside the function scope here,
  3 so as to allow these functions to be easily imported without worrying about
  4 circular imports.
  5 """
  6 from django.db.utils import OperationalError
  7 from django.db.utils import ProgrammingError
  8 
  9 LANDING_PAGE_SIGN_IN = "sign-in"
  10 LANDING_PAGE_LEARN = "learn"
  11 
  12 APP_KEY_COOKIE_NAME = "app_key_cookie"
  13 
  14 
  15 class DeviceNotProvisioned(Exception):
  16     pass
  17 
  18 
  19 no_default_value = object()
  20 
  21 
  22 def get_device_setting(setting, default=no_default_value):
  23     from .models import DeviceSettings
  24 
  25     try:
  26         device_settings = DeviceSettings.objects.get()
  27         if device_settings is None:
  28             raise DeviceSettings.DoesNotExist
  29         return getattr(device_settings, setting)
  30     except (DeviceSettings.DoesNotExist, OperationalError, ProgrammingError):
  31         if default is not no_default_value:
  32             return default
  33         raise DeviceNotProvisioned
  34 
  35 
  36 def device_provisioned():
  37     return get_device_setting("is_provisioned", False)
  38 
  39 
  40 def is_landing_page(landing_page):
  41     return get_device_setting("landing_page", LANDING_PAGE_SIGN_IN) == landing_page
  42 
  43 
  44 def allow_guest_access():
  45     if get_device_setting("allow_guest_access", False):
  46         return True
  47 
  48     return is_landing_page(LANDING_PAGE_LEARN)
  49 
  50 
  51 def allow_learner_unassigned_resource_access():
  52     if get_device_setting("allow_learner_unassigned_resource_access", True):
  53         return True
  54 
  55     return is_landing_page(LANDING_PAGE_LEARN)
  56 
  57 
  58 def allow_peer_unlisted_channel_import():
  59     return get_device_setting("allow_peer_unlisted_channel_import", False)
  60 
  61 
  62 def allow_other_browsers_to_connect():
  63     return get_device_setting("allow_other_browsers_to_connect", True)
  64 
  65 
  66 def set_device_settings(**kwargs):
  67     from .models import DeviceSettings
  68 
  69     try:
  70         device_settings = DeviceSettings.objects.get()
  71         for key, value in kwargs.items():
  72             setattr(device_settings, key, value)
  73         device_settings.save()
  74     except DeviceSettings.DoesNotExist:
  75         raise DeviceNotProvisioned
  76 
  77 
  78 def create_superuser(user_data, facility):
  79     from .models import DevicePermissions
  80     from kolibri.core.auth.models import FacilityUser
  81     from django.core.exceptions import ValidationError
  82 
  83     username = user_data.get("username")
  84     password = user_data.get("password")
  85     full_name = user_data.get("full_name")
  86 
  87     # Code copied from FacilityUserModelManager (create_superuser method doesn't work)
  88     if FacilityUser.objects.filter(
  89         username__iexact=username, facility=facility
  90     ).exists():
  91         raise ValidationError("An account with that username already exists")
  92 
  93     superuser = FacilityUser.objects.create(
  94         full_name=full_name or username,
  95         username=username,
  96         password=password,
  97         facility=facility,
  98     )
  99 
  100     superuser.full_clean()
  101     superuser.set_password(password)
  102     superuser.save()
  103 
  104     # make the user a facility admin
  105     facility.add_admin(superuser)
  106 
  107     # make the user into a superuser on this device
  108     DevicePermissions.objects.create(
  109         user=superuser, is_superuser=True, can_manage_content=True
  110     )
  111     return superuser
  112 
  113 
  114 def provision_device(device_name=None, **kwargs):
  115     from .models import DeviceSettings
  116 
  117     device_settings, _ = DeviceSettings.objects.get_or_create(defaults=kwargs)
  118     if device_name is not None:
  119         device_settings.name = device_name
  120     device_settings.is_provisioned = True
  121     device_settings.save()
  122 
  123 
  124 def valid_app_key(app_key):
  125     from .models import DeviceAppKey
  126 
  127     return app_key == DeviceAppKey.get_app_key()
  128 
  129 
  130 def valid_app_key_on_request(request):
  131     return APP_KEY_COOKIE_NAME in request.COOKIES and valid_app_key(
  132         request.COOKIES.get(APP_KEY_COOKIE_NAME)
  133     )
  134 
  135 
  136 def set_app_key_on_response(response):
  137     from .models import DeviceAppKey
  138 
  139     response.set_cookie(APP_KEY_COOKIE_NAME, DeviceAppKey.get_app_key())
  140
  [end of kolibri/core/device/utils.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/kolibri/core/device/utils.py b/kolibri/core/device/utils.py
  --- a/kolibri/core/device/utils.py
  +++ b/kolibri/core/device/utils.py
  @@ -90,11 +90,15 @@
       ).exists():
           raise ValidationError("An account with that username already exists")
   
  +    # gender and birth_year are set to "DEFERRED", since superusers do not
  +    # need to provide this and are not nudged to update profile on Learn page
       superuser = FacilityUser.objects.create(
           full_name=full_name or username,
           username=username,
           password=password,
           facility=facility,
  +        gender="DEFERRED",
  +        birth_year="DEFERRED",
       )
   
       superuser.full_clean()
  
verification_info: {"golden_diff": "diff --git a/kolibri/core/device/utils.py b/kolibri/core/device/utils.py\n--- a/kolibri/core/device/utils.py\n+++ b/kolibri/core/device/utils.py\n@@ -90,11 +90,15 @@\n     ).exists():\n         raise ValidationError(\"An account with that username already exists\")\n \n+    # gender and birth_year are set to \"DEFERRED\", since superusers do not\n+    # need to provide this and are not nudged to update profile on Learn page\n     superuser = FacilityUser.objects.create(\n         full_name=full_name or username,\n         username=username,\n         password=password,\n         facility=facility,\n+        gender=\"DEFERRED\",\n+        birth_year=\"DEFERRED\",\n     )\n \n     superuser.full_clean()\n", "issue": "Update profile modal displays to super admin account created with setup wizard \n### Observed behavior\r\n_(Wouldn't even know this might be an issue if I hadn't been reviewing super admin Gherkins all past week :blush:)_\r\n\r\nAccording to the [Gherkin scenario](https://github.com/learningequality/kolibri/blob/release-v0.13.x/integration_testing/features/learner/learner-profile-update-notification.feature#L22), this should not appear:\r\n\r\n![Ubuntu16 04 (start)  Running  - Oracle VM VirtualBox_677](https://user-images.githubusercontent.com/1457929/85937605-68a76f80-b905-11ea-8f75-88ff846fa271.png)\r\n\r\n### Expected behavior\r\nNo profile update modal for the super admin.\r\n\r\n### User-facing consequences\r\nAnnoyed super admin.\r\n\r\n### Errors and logs\r\n\u2026\r\n\r\n### Steps to reproduce\r\n1. Install Kolibri\r\n2. Go through the setup wizard\r\n3. Go to Learn \r\n\r\n### Context\r\n * Kolibri version: 0.14.0b6, DEB installer\r\n * Operating system: Ubuntu 16.04\r\n * Browser: both Firefox and Chrome\r\n\n", "before_files": [{"content": "\"\"\"\nDo all imports of the device settings model inside the function scope here,\nso as to allow these functions to be easily imported without worrying about\ncircular imports.\n\"\"\"\nfrom django.db.utils import OperationalError\nfrom django.db.utils import ProgrammingError\n\nLANDING_PAGE_SIGN_IN = \"sign-in\"\nLANDING_PAGE_LEARN = \"learn\"\n\nAPP_KEY_COOKIE_NAME = \"app_key_cookie\"\n\n\nclass DeviceNotProvisioned(Exception):\n    pass\n\n\nno_default_value = object()\n\n\ndef get_device_setting(setting, default=no_default_value):\n    from .models import DeviceSettings\n\n    try:\n        device_settings = DeviceSettings.objects.get()\n        if device_settings is None:\n            raise DeviceSettings.DoesNotExist\n        return getattr(device_settings, setting)\n    except (DeviceSettings.DoesNotExist, OperationalError, ProgrammingError):\n        if default is not no_default_value:\n            return default\n        raise DeviceNotProvisioned\n\n\ndef device_provisioned():\n    return get_device_setting(\"is_provisioned\", False)\n\n\ndef is_landing_page(landing_page):\n    return get_device_setting(\"landing_page\", LANDING_PAGE_SIGN_IN) == landing_page\n\n\ndef allow_guest_access():\n    if get_device_setting(\"allow_guest_access\", False):\n        return True\n\n    return is_landing_page(LANDING_PAGE_LEARN)\n\n\ndef allow_learner_unassigned_resource_access():\n    if get_device_setting(\"allow_learner_unassigned_resource_access\", True):\n        return True\n\n    return is_landing_page(LANDING_PAGE_LEARN)\n\n\ndef allow_peer_unlisted_channel_import():\n    return get_device_setting(\"allow_peer_unlisted_channel_import\", False)\n\n\ndef allow_other_browsers_to_connect():\n    return get_device_setting(\"allow_other_browsers_to_connect\", True)\n\n\ndef set_device_settings(**kwargs):\n    from .models import DeviceSettings\n\n    try:\n        device_settings = DeviceSettings.objects.get()\n        for key, value in kwargs.items():\n            setattr(device_settings, key, value)\n        device_settings.save()\n    except DeviceSettings.DoesNotExist:\n        raise DeviceNotProvisioned\n\n\ndef create_superuser(user_data, facility):\n    from .models import DevicePermissions\n    from kolibri.core.auth.models import FacilityUser\n    from django.core.exceptions import ValidationError\n\n    username = user_data.get(\"username\")\n    password = user_data.get(\"password\")\n    full_name = user_data.get(\"full_name\")\n\n    # Code copied from FacilityUserModelManager (create_superuser method doesn't work)\n    if FacilityUser.objects.filter(\n        username__iexact=username, facility=facility\n    ).exists():\n        raise ValidationError(\"An account with that username already exists\")\n\n    superuser = FacilityUser.objects.create(\n        full_name=full_name or username,\n        username=username,\n        password=password,\n        facility=facility,\n    )\n\n    superuser.full_clean()\n    superuser.set_password(password)\n    superuser.save()\n\n    # make the user a facility admin\n    facility.add_admin(superuser)\n\n    # make the user into a superuser on this device\n    DevicePermissions.objects.create(\n        user=superuser, is_superuser=True, can_manage_content=True\n    )\n    return superuser\n\n\ndef provision_device(device_name=None, **kwargs):\n    from .models import DeviceSettings\n\n    device_settings, _ = DeviceSettings.objects.get_or_create(defaults=kwargs)\n    if device_name is not None:\n        device_settings.name = device_name\n    device_settings.is_provisioned = True\n    device_settings.save()\n\n\ndef valid_app_key(app_key):\n    from .models import DeviceAppKey\n\n    return app_key == DeviceAppKey.get_app_key()\n\n\ndef valid_app_key_on_request(request):\n    return APP_KEY_COOKIE_NAME in request.COOKIES and valid_app_key(\n        request.COOKIES.get(APP_KEY_COOKIE_NAME)\n    )\n\n\ndef set_app_key_on_response(response):\n    from .models import DeviceAppKey\n\n    response.set_cookie(APP_KEY_COOKIE_NAME, DeviceAppKey.get_app_key())\n", "path": "kolibri/core/device/utils.py"}]}