prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Challenge creation notifications
  At the moment, staff users receive emails about new challenges. It would be nice to turns those emails into notifications. 
  
  **Challenge creation emails**
  
  - create follow: `staff users` --> `gc.localhost Site`
  - upon challenge creation: send `action` with challenge `creator` as `actor`, the created `challenge` as `action_object` and the `gc.localhost site` as `target`
  - _Notification template:_ print action as is for normal challenges, for external challenges, make sure to link the `update_url` for the challenge in the notification rather than the challenge url
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `app/grandchallenge/challenges/emails.py`
  Content:
  ```
  1 from django.conf import settings
  2 from django.contrib.auth import get_user_model
  3 from django.contrib.sites.models import Site
  4 from django.core.mail import send_mail
  5 
  6 from grandchallenge.subdomains.utils import reverse
  7 
  8 
  9 def send_challenge_created_email(challenge):
  10     site = Site.objects.get_current()
  11     message = (
  12         f"Dear {{}},\n\n"
  13         f"User {challenge.creator} has just created the challenge "
  14         f"{challenge.short_name} at {challenge.get_absolute_url()}.\n\n"
  15         f"Regards,\n"
  16         f"{site.name}\n\n"
  17         f"This is an automated service email from {site.domain}."
  18     )
  19 
  20     staff = get_user_model().objects.filter(is_staff=True)
  21 
  22     for s in staff:
  23         send_mail(
  24             subject=f"[{site.domain.lower()}] New Challenge Created",
  25             message=message.format(s.username),
  26             from_email=settings.DEFAULT_FROM_EMAIL,
  27             recipient_list=[s.email],
  28         )
  29 
  30 
  31 def send_external_challenge_created_email(challenge):
  32     site = Site.objects.get_current()
  33     update_url = reverse(
  34         "challenges:external-update",
  35         kwargs={"short_name": challenge.short_name},
  36     )
  37 
  38     message = (
  39         f"Dear {{}},\n\n"
  40         f"User {challenge.creator} has just created the challenge "
  41         f"{challenge.short_name}. You need to un-hide it before it is visible "
  42         f"on the all challenges page, you can do that here: {update_url}\n\n"
  43         f"Regards,\n"
  44         f"{site.name}\n\n"
  45         f"This is an automated service email from {site.domain}."
  46     )
  47 
  48     staff = get_user_model().objects.filter(is_staff=True)
  49 
  50     for s in staff:
  51         send_mail(
  52             subject=f"[{site.domain.lower()}] New External Challenge",
  53             message=message.format(s.username),
  54             from_email=settings.DEFAULT_FROM_EMAIL,
  55             recipient_list=[s.email],
  56         )
  57
  ```
  --- 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/app/grandchallenge/challenges/emails.py b/app/grandchallenge/challenges/emails.py
  --- a/app/grandchallenge/challenges/emails.py
  +++ b/app/grandchallenge/challenges/emails.py
  @@ -1,7 +1,5 @@
  -from django.conf import settings
  -from django.contrib.auth import get_user_model
   from django.contrib.sites.models import Site
  -from django.core.mail import send_mail
  +from django.core.mail import mail_managers
   
   from grandchallenge.subdomains.utils import reverse
   
  @@ -9,7 +7,7 @@
   def send_challenge_created_email(challenge):
       site = Site.objects.get_current()
       message = (
  -        f"Dear {{}},\n\n"
  +        f"Dear manager,\n\n"
           f"User {challenge.creator} has just created the challenge "
           f"{challenge.short_name} at {challenge.get_absolute_url()}.\n\n"
           f"Regards,\n"
  @@ -17,15 +15,10 @@
           f"This is an automated service email from {site.domain}."
       )
   
  -    staff = get_user_model().objects.filter(is_staff=True)
  -
  -    for s in staff:
  -        send_mail(
  -            subject=f"[{site.domain.lower()}] New Challenge Created",
  -            message=message.format(s.username),
  -            from_email=settings.DEFAULT_FROM_EMAIL,
  -            recipient_list=[s.email],
  -        )
  +    mail_managers(
  +        subject=f"[{site.domain.lower()}] New Challenge Created",
  +        message=message,
  +    )
   
   
   def send_external_challenge_created_email(challenge):
  @@ -36,7 +29,7 @@
       )
   
       message = (
  -        f"Dear {{}},\n\n"
  +        f"Dear manager,\n\n"
           f"User {challenge.creator} has just created the challenge "
           f"{challenge.short_name}. You need to un-hide it before it is visible "
           f"on the all challenges page, you can do that here: {update_url}\n\n"
  @@ -45,12 +38,7 @@
           f"This is an automated service email from {site.domain}."
       )
   
  -    staff = get_user_model().objects.filter(is_staff=True)
  -
  -    for s in staff:
  -        send_mail(
  -            subject=f"[{site.domain.lower()}] New External Challenge",
  -            message=message.format(s.username),
  -            from_email=settings.DEFAULT_FROM_EMAIL,
  -            recipient_list=[s.email],
  -        )
  +    mail_managers(
  +        subject=f"[{site.domain.lower()}] New External Challenge",
  +        message=message,
  +    )
  
verification_info: {"golden_diff": "diff --git a/app/grandchallenge/challenges/emails.py b/app/grandchallenge/challenges/emails.py\n--- a/app/grandchallenge/challenges/emails.py\n+++ b/app/grandchallenge/challenges/emails.py\n@@ -1,7 +1,5 @@\n-from django.conf import settings\n-from django.contrib.auth import get_user_model\n from django.contrib.sites.models import Site\n-from django.core.mail import send_mail\n+from django.core.mail import mail_managers\n \n from grandchallenge.subdomains.utils import reverse\n \n@@ -9,7 +7,7 @@\n def send_challenge_created_email(challenge):\n     site = Site.objects.get_current()\n     message = (\n-        f\"Dear {{}},\\n\\n\"\n+        f\"Dear manager,\\n\\n\"\n         f\"User {challenge.creator} has just created the challenge \"\n         f\"{challenge.short_name} at {challenge.get_absolute_url()}.\\n\\n\"\n         f\"Regards,\\n\"\n@@ -17,15 +15,10 @@\n         f\"This is an automated service email from {site.domain}.\"\n     )\n \n-    staff = get_user_model().objects.filter(is_staff=True)\n-\n-    for s in staff:\n-        send_mail(\n-            subject=f\"[{site.domain.lower()}] New Challenge Created\",\n-            message=message.format(s.username),\n-            from_email=settings.DEFAULT_FROM_EMAIL,\n-            recipient_list=[s.email],\n-        )\n+    mail_managers(\n+        subject=f\"[{site.domain.lower()}] New Challenge Created\",\n+        message=message,\n+    )\n \n \n def send_external_challenge_created_email(challenge):\n@@ -36,7 +29,7 @@\n     )\n \n     message = (\n-        f\"Dear {{}},\\n\\n\"\n+        f\"Dear manager,\\n\\n\"\n         f\"User {challenge.creator} has just created the challenge \"\n         f\"{challenge.short_name}. You need to un-hide it before it is visible \"\n         f\"on the all challenges page, you can do that here: {update_url}\\n\\n\"\n@@ -45,12 +38,7 @@\n         f\"This is an automated service email from {site.domain}.\"\n     )\n \n-    staff = get_user_model().objects.filter(is_staff=True)\n-\n-    for s in staff:\n-        send_mail(\n-            subject=f\"[{site.domain.lower()}] New External Challenge\",\n-            message=message.format(s.username),\n-            from_email=settings.DEFAULT_FROM_EMAIL,\n-            recipient_list=[s.email],\n-        )\n+    mail_managers(\n+        subject=f\"[{site.domain.lower()}] New External Challenge\",\n+        message=message,\n+    )\n", "issue": "Challenge creation notifications\nAt the moment, staff users receive emails about new challenges. It would be nice to turns those emails into notifications. \r\n\r\n**Challenge creation emails**\r\n\r\n- create follow: `staff users` --> `gc.localhost Site`\r\n- upon challenge creation: send `action` with challenge `creator` as `actor`, the created `challenge` as `action_object` and the `gc.localhost site` as `target`\r\n- _Notification template:_ print action as is for normal challenges, for external challenges, make sure to link the `update_url` for the challenge in the notification rather than the challenge url\n", "before_files": [{"content": "from django.conf import settings\nfrom django.contrib.auth import get_user_model\nfrom django.contrib.sites.models import Site\nfrom django.core.mail import send_mail\n\nfrom grandchallenge.subdomains.utils import reverse\n\n\ndef send_challenge_created_email(challenge):\n    site = Site.objects.get_current()\n    message = (\n        f\"Dear {{}},\\n\\n\"\n        f\"User {challenge.creator} has just created the challenge \"\n        f\"{challenge.short_name} at {challenge.get_absolute_url()}.\\n\\n\"\n        f\"Regards,\\n\"\n        f\"{site.name}\\n\\n\"\n        f\"This is an automated service email from {site.domain}.\"\n    )\n\n    staff = get_user_model().objects.filter(is_staff=True)\n\n    for s in staff:\n        send_mail(\n            subject=f\"[{site.domain.lower()}] New Challenge Created\",\n            message=message.format(s.username),\n            from_email=settings.DEFAULT_FROM_EMAIL,\n            recipient_list=[s.email],\n        )\n\n\ndef send_external_challenge_created_email(challenge):\n    site = Site.objects.get_current()\n    update_url = reverse(\n        \"challenges:external-update\",\n        kwargs={\"short_name\": challenge.short_name},\n    )\n\n    message = (\n        f\"Dear {{}},\\n\\n\"\n        f\"User {challenge.creator} has just created the challenge \"\n        f\"{challenge.short_name}. You need to un-hide it before it is visible \"\n        f\"on the all challenges page, you can do that here: {update_url}\\n\\n\"\n        f\"Regards,\\n\"\n        f\"{site.name}\\n\\n\"\n        f\"This is an automated service email from {site.domain}.\"\n    )\n\n    staff = get_user_model().objects.filter(is_staff=True)\n\n    for s in staff:\n        send_mail(\n            subject=f\"[{site.domain.lower()}] New External Challenge\",\n            message=message.format(s.username),\n            from_email=settings.DEFAULT_FROM_EMAIL,\n            recipient_list=[s.email],\n        )\n", "path": "app/grandchallenge/challenges/emails.py"}], "after_files": [{"content": "from django.contrib.sites.models import Site\nfrom django.core.mail import mail_managers\n\nfrom grandchallenge.subdomains.utils import reverse\n\n\ndef send_challenge_created_email(challenge):\n    site = Site.objects.get_current()\n    message = (\n        f\"Dear manager,\\n\\n\"\n        f\"User {challenge.creator} has just created the challenge \"\n        f\"{challenge.short_name} at {challenge.get_absolute_url()}.\\n\\n\"\n        f\"Regards,\\n\"\n        f\"{site.name}\\n\\n\"\n        f\"This is an automated service email from {site.domain}.\"\n    )\n\n    mail_managers(\n        subject=f\"[{site.domain.lower()}] New Challenge Created\",\n        message=message,\n    )\n\n\ndef send_external_challenge_created_email(challenge):\n    site = Site.objects.get_current()\n    update_url = reverse(\n        \"challenges:external-update\",\n        kwargs={\"short_name\": challenge.short_name},\n    )\n\n    message = (\n        f\"Dear manager,\\n\\n\"\n        f\"User {challenge.creator} has just created the challenge \"\n        f\"{challenge.short_name}. You need to un-hide it before it is visible \"\n        f\"on the all challenges page, you can do that here: {update_url}\\n\\n\"\n        f\"Regards,\\n\"\n        f\"{site.name}\\n\\n\"\n        f\"This is an automated service email from {site.domain}.\"\n    )\n\n    mail_managers(\n        subject=f\"[{site.domain.lower()}] New External Challenge\",\n        message=message,\n    )\n", "path": "app/grandchallenge/challenges/emails.py"}]}