We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Server Error (500) when adding attribute
Hi,

First of all thanks for this excellent software, makes my life easier.

I deployed it on heroku using the heroku elements (https://elements.heroku.com/buttons/mirumee/saleor).

Then I tried to add an attribute but that resulted in Server Error (500) page. Is this expected behavior? Any settings that have to be changed? If yes then any way to do that on heroku?

Thanks!


--- 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/product/models/utils.py`
Content:
```
1 from django.utils.encoding import smart_text
2 
3 
4 def get_attributes_display_map(obj, attributes):
5     display_map = {}
6     for attribute in attributes:
7         value = obj.attributes.get(smart_text(attribute.pk))
8         if value:
9             choices = {smart_text(a.pk): a for a in attribute.values.all()}
10             choice_obj = choices.get(value)
11             if choice_obj:
12                 display_map[attribute.pk] = choice_obj
13             else:
14                 display_map[attribute.pk] = value_pk
15     return display_map
16
```
--- 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()

```

diff --git a/saleor/product/models/utils.py b/saleor/product/models/utils.py
--- a/saleor/product/models/utils.py
+++ b/saleor/product/models/utils.py
@@ -11,5 +11,5 @@
             if choice_obj:
                 display_map[attribute.pk] = choice_obj
             else:
-                display_map[attribute.pk] = value_pk
+                display_map[attribute.pk] = value
     return display_map

{"golden_diff": "diff --git a/saleor/product/models/utils.py b/saleor/product/models/utils.py\n--- a/saleor/product/models/utils.py\n+++ b/saleor/product/models/utils.py\n@@ -11,5 +11,5 @@\n             if choice_obj:\n                 display_map[attribute.pk] = choice_obj\n             else:\n-                display_map[attribute.pk] = value_pk\n+                display_map[attribute.pk] = value\n     return display_map\n", "issue": "Server Error (500) when adding attribute\nHi,\r\n\r\nFirst of all thanks for this excellent software, makes my life easier.\r\n\r\nI deployed it on heroku using the heroku elements (https://elements.heroku.com/buttons/mirumee/saleor).\r\n\r\nThen I tried to add an attribute but that resulted in Server Error (500) page. Is this expected behavior? Any settings that have to be changed? If yes then any way to do that on heroku?\r\n\r\nThanks!\r\n\n", "before_files": [{"content": "from django.utils.encoding import smart_text\n\n\ndef get_attributes_display_map(obj, attributes):\n    display_map = {}\n    for attribute in attributes:\n        value = obj.attributes.get(smart_text(attribute.pk))\n        if value:\n            choices = {smart_text(a.pk): a for a in attribute.values.all()}\n            choice_obj = choices.get(value)\n            if choice_obj:\n                display_map[attribute.pk] = choice_obj\n            else:\n                display_map[attribute.pk] = value_pk\n    return display_map\n", "path": "saleor/product/models/utils.py"}], "after_files": [{"content": "from django.utils.encoding import smart_text\n\n\ndef get_attributes_display_map(obj, attributes):\n    display_map = {}\n    for attribute in attributes:\n        value = obj.attributes.get(smart_text(attribute.pk))\n        if value:\n            choices = {smart_text(a.pk): a for a in attribute.values.all()}\n            choice_obj = choices.get(value)\n            if choice_obj:\n                display_map[attribute.pk] = choice_obj\n            else:\n                display_map[attribute.pk] = value\n    return display_map\n", "path": "saleor/product/models/utils.py"}]}