prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Display personal deadline extensions on a student’s points page
  A student’s points page in A+ just shows the official deadlines for each module. Personalized deadlines are not shown. This has repeatedly caused confusion when a student believes there’s something wrong with their personalized deadline. It would be better if the student was able to see the actual deadlines on their points page (and possibly elsewhere?). 
  
  This would also eliminate some confusion in communications between members of course staff, as staff members would also easily see the student’s DL extensions. 
  
  I’m not sure off the top of my head how best to display this on the page.
  
  
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `course/templatetags/course.py`
  Content:
  ```
  1 from typing import Any, Dict, List, Union
  2 
  3 from django import template
  4 from django.db import models
  5 from django.utils.safestring import mark_safe
  6 from django.utils.translation import get_language
  7 
  8 from exercise.cache.content import CachedContent
  9 from course.models import CourseInstance, UserTagging
  10 from lib.localization_syntax import pick_localized
  11 from userprofile.models import UserProfile
  12 from ..cache.menu import CachedTopMenu
  13 
  14 
  15 register = template.Library()
  16 
  17 
  18 def _prepare_topmenu(context):
  19     if 'topmenu' not in context:
  20         request = context.get('request', None)
  21         context['topmenu'] = CachedTopMenu(request.user if request else None)
  22     return context['topmenu']
  23 
  24 
  25 @register.inclusion_tag("course/_course_dropdown_menu.html", takes_context=True)
  26 def course_menu(context):
  27     menu = _prepare_topmenu(context)
  28     return { "instances": menu.courses() }
  29 
  30 
  31 @register.inclusion_tag('course/_group_select.html', takes_context=True)
  32 def group_select(context):
  33     instance = context.get('instance', None)
  34     if not instance:
  35         return { 'groups': [] }
  36     menu = _prepare_topmenu(context)
  37     groups, selected = menu.groups(instance)
  38     return {
  39         'instance': instance,
  40         'groups': groups,
  41         'selected': selected,
  42     }
  43 
  44 
  45 @register.filter
  46 def escape_slashes(string):
  47     return str(string).replace('/', '\/') # noqa: W605
  48 
  49 @register.filter
  50 def parse_localization(entry):
  51     return pick_localized(entry, get_language())
  52 
  53 
  54 @register.filter
  55 def list_unselected(langs):
  56     listed = list(filter(lambda x: x and x != get_language(), langs.split("|")))
  57     return listed
  58 
  59 
  60 @register.filter
  61 def is_visible(entry):
  62     return CachedContent.is_visible(entry)
  63 
  64 
  65 @register.filter
  66 def is_visible_to(entry, user):
  67     return entry.is_visible_to(user)
  68 
  69 
  70 @register.filter
  71 def is_listed(entry):
  72     return CachedContent.is_listed(entry)
  73 
  74 
  75 @register.filter
  76 def len_listed(entries):
  77     return len([e for e in entries if CachedContent.is_listed(e)])
  78 
  79 
  80 @register.filter
  81 def is_in_maintenance(entry):
  82     return CachedContent.is_in_maintenance(entry)
  83 
  84 
  85 @register.filter
  86 def exercises_open(entry, now):
  87     return entry['opening_time'] <= now <= entry['closing_time']
  88 
  89 
  90 @register.filter
  91 def exercises_submittable(entry, now):
  92     if entry['late_allowed']:
  93         return entry['opening_time'] <= now <= entry['late_time']
  94     return entry['opening_time'] <= now <= entry['closing_time']
  95 
  96 
  97 @register.filter
  98 def has_opened(entry, now):
  99     return entry['opening_time'] <= now
  100 
  101 
  102 @register.filter
  103 def url(model_object, name=None):
  104     if name:
  105         return model_object.get_url(name)
  106     return model_object.get_display_url()
  107 
  108 
  109 @register.filter
  110 def names(profiles):
  111     return ", ".join(p.user.get_full_name() for p in profiles)
  112 
  113 
  114 @register.inclusion_tag('course/_avatars.html')
  115 def avatars(profiles):
  116     return { 'profiles': profiles }
  117 
  118 
  119 @register.inclusion_tag("course/_profiles.html")
  120 def profiles(
  121         profiles: Union[UserProfile, List[UserProfile], models.QuerySet[UserProfile]],
  122         instance: CourseInstance,
  123         is_teacher: bool
  124         ) -> Dict[str, Any]:
  125     if isinstance(profiles, UserProfile):
  126         profiles = [profiles]
  127     elif isinstance(profiles, models.QuerySet):
  128         # Avoid re-fetching the queryset
  129         profiles = list(profiles)
  130     return {
  131         'instance': instance,
  132         'profiles': profiles,
  133         'is_teacher': is_teacher,
  134     }
  135 
  136 
  137 @register.simple_tag
  138 def tags(profile, instance):
  139     tags = UserTagging.objects.get_all(profile, instance)
  140     return mark_safe(' '.join(tag.html_label for tag in tags))
  141 
  142 
  143 @register.filter
  144 def enrollment_audience(enrollment_audience_val):
  145     # convert enrollment audience Enum value to the string description
  146     return CourseInstance.ENROLLMENT_AUDIENCE[enrollment_audience_val]
  147 
  148 
  149 @register.filter
  150 def view_content_to(view_content_to_val):
  151     # convert "view content to" Enum value to the string description
  152     return CourseInstance.VIEW_ACCESS[view_content_to_val]
  153 
  154 
  155 @register.filter
  156 def is_banned_student(profile, course_instance):
  157     return course_instance.is_banned(profile.user)
  158
  ```
  --- 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/course/templatetags/course.py b/course/templatetags/course.py
  --- a/course/templatetags/course.py
  +++ b/course/templatetags/course.py
  @@ -1,4 +1,5 @@
   from typing import Any, Dict, List, Union
  +from copy import deepcopy
   
   from django import template
   from django.db import models
  @@ -22,6 +23,11 @@
       return context['topmenu']
   
   
  +def _deadline_extended_exercise_open(entry, now):
  +    personal_deadline = entry.get('personal_deadline')
  +    return personal_deadline is not None and entry['opening_time'] <= now <= personal_deadline
  +
  +
   @register.inclusion_tag("course/_course_dropdown_menu.html", takes_context=True)
   def course_menu(context):
       menu = _prepare_topmenu(context)
  @@ -87,6 +93,17 @@
       return entry['opening_time'] <= now <= entry['closing_time']
   
   
  +@register.filter
  +def deadline_extended_exercise_open(entry, now):
  +    return _deadline_extended_exercise_open(entry, now)
  +
  +
  +@register.filter
  +def deadline_extended_exercises_open(entry, now):
  +    entries = deepcopy(entry['flatted'])
  +    return any(_deadline_extended_exercise_open(entry, now) for entry in entries)
  +
  +
   @register.filter
   def exercises_submittable(entry, now):
       if entry['late_allowed']:
  
verification_info: {"golden_diff": "diff --git a/course/templatetags/course.py b/course/templatetags/course.py\n--- a/course/templatetags/course.py\n+++ b/course/templatetags/course.py\n@@ -1,4 +1,5 @@\n from typing import Any, Dict, List, Union\n+from copy import deepcopy\n \n from django import template\n from django.db import models\n@@ -22,6 +23,11 @@\n     return context['topmenu']\n \n \n+def _deadline_extended_exercise_open(entry, now):\n+    personal_deadline = entry.get('personal_deadline')\n+    return personal_deadline is not None and entry['opening_time'] <= now <= personal_deadline\n+\n+\n @register.inclusion_tag(\"course/_course_dropdown_menu.html\", takes_context=True)\n def course_menu(context):\n     menu = _prepare_topmenu(context)\n@@ -87,6 +93,17 @@\n     return entry['opening_time'] <= now <= entry['closing_time']\n \n \n+@register.filter\n+def deadline_extended_exercise_open(entry, now):\n+    return _deadline_extended_exercise_open(entry, now)\n+\n+\n+@register.filter\n+def deadline_extended_exercises_open(entry, now):\n+    entries = deepcopy(entry['flatted'])\n+    return any(_deadline_extended_exercise_open(entry, now) for entry in entries)\n+\n+\n @register.filter\n def exercises_submittable(entry, now):\n     if entry['late_allowed']:\n", "issue": "Display personal deadline extensions on a student\u2019s points page\nA student\u2019s points page in A+ just shows the official deadlines for each module. Personalized deadlines are not shown. This has repeatedly caused confusion when a student believes there\u2019s something wrong with their personalized deadline. It would be better if the student was able to see the actual deadlines on their points page (and possibly elsewhere?). \r\n\r\nThis would also eliminate some confusion in communications between members of course staff, as staff members would also easily see the student\u2019s DL extensions. \r\n\r\nI\u2019m not sure off the top of my head how best to display this on the page.\r\n\r\n\r\n\r\n\n", "before_files": [{"content": "from typing import Any, Dict, List, Union\n\nfrom django import template\nfrom django.db import models\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import get_language\n\nfrom exercise.cache.content import CachedContent\nfrom course.models import CourseInstance, UserTagging\nfrom lib.localization_syntax import pick_localized\nfrom userprofile.models import UserProfile\nfrom ..cache.menu import CachedTopMenu\n\n\nregister = template.Library()\n\n\ndef _prepare_topmenu(context):\n    if 'topmenu' not in context:\n        request = context.get('request', None)\n        context['topmenu'] = CachedTopMenu(request.user if request else None)\n    return context['topmenu']\n\n\n@register.inclusion_tag(\"course/_course_dropdown_menu.html\", takes_context=True)\ndef course_menu(context):\n    menu = _prepare_topmenu(context)\n    return { \"instances\": menu.courses() }\n\n\n@register.inclusion_tag('course/_group_select.html', takes_context=True)\ndef group_select(context):\n    instance = context.get('instance', None)\n    if not instance:\n        return { 'groups': [] }\n    menu = _prepare_topmenu(context)\n    groups, selected = menu.groups(instance)\n    return {\n        'instance': instance,\n        'groups': groups,\n        'selected': selected,\n    }\n\n\n@register.filter\ndef escape_slashes(string):\n    return str(string).replace('/', '\\/') # noqa: W605\n\n@register.filter\ndef parse_localization(entry):\n    return pick_localized(entry, get_language())\n\n\n@register.filter\ndef list_unselected(langs):\n    listed = list(filter(lambda x: x and x != get_language(), langs.split(\"|\")))\n    return listed\n\n\n@register.filter\ndef is_visible(entry):\n    return CachedContent.is_visible(entry)\n\n\n@register.filter\ndef is_visible_to(entry, user):\n    return entry.is_visible_to(user)\n\n\n@register.filter\ndef is_listed(entry):\n    return CachedContent.is_listed(entry)\n\n\n@register.filter\ndef len_listed(entries):\n    return len([e for e in entries if CachedContent.is_listed(e)])\n\n\n@register.filter\ndef is_in_maintenance(entry):\n    return CachedContent.is_in_maintenance(entry)\n\n\n@register.filter\ndef exercises_open(entry, now):\n    return entry['opening_time'] <= now <= entry['closing_time']\n\n\n@register.filter\ndef exercises_submittable(entry, now):\n    if entry['late_allowed']:\n        return entry['opening_time'] <= now <= entry['late_time']\n    return entry['opening_time'] <= now <= entry['closing_time']\n\n\n@register.filter\ndef has_opened(entry, now):\n    return entry['opening_time'] <= now\n\n\n@register.filter\ndef url(model_object, name=None):\n    if name:\n        return model_object.get_url(name)\n    return model_object.get_display_url()\n\n\n@register.filter\ndef names(profiles):\n    return \", \".join(p.user.get_full_name() for p in profiles)\n\n\n@register.inclusion_tag('course/_avatars.html')\ndef avatars(profiles):\n    return { 'profiles': profiles }\n\n\n@register.inclusion_tag(\"course/_profiles.html\")\ndef profiles(\n        profiles: Union[UserProfile, List[UserProfile], models.QuerySet[UserProfile]],\n        instance: CourseInstance,\n        is_teacher: bool\n        ) -> Dict[str, Any]:\n    if isinstance(profiles, UserProfile):\n        profiles = [profiles]\n    elif isinstance(profiles, models.QuerySet):\n        # Avoid re-fetching the queryset\n        profiles = list(profiles)\n    return {\n        'instance': instance,\n        'profiles': profiles,\n        'is_teacher': is_teacher,\n    }\n\n\n@register.simple_tag\ndef tags(profile, instance):\n    tags = UserTagging.objects.get_all(profile, instance)\n    return mark_safe(' '.join(tag.html_label for tag in tags))\n\n\n@register.filter\ndef enrollment_audience(enrollment_audience_val):\n    # convert enrollment audience Enum value to the string description\n    return CourseInstance.ENROLLMENT_AUDIENCE[enrollment_audience_val]\n\n\n@register.filter\ndef view_content_to(view_content_to_val):\n    # convert \"view content to\" Enum value to the string description\n    return CourseInstance.VIEW_ACCESS[view_content_to_val]\n\n\n@register.filter\ndef is_banned_student(profile, course_instance):\n    return course_instance.is_banned(profile.user)\n", "path": "course/templatetags/course.py"}], "after_files": [{"content": "from typing import Any, Dict, List, Union\nfrom copy import deepcopy\n\nfrom django import template\nfrom django.db import models\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import get_language\n\nfrom exercise.cache.content import CachedContent\nfrom course.models import CourseInstance, UserTagging\nfrom lib.localization_syntax import pick_localized\nfrom userprofile.models import UserProfile\nfrom ..cache.menu import CachedTopMenu\n\n\nregister = template.Library()\n\n\ndef _prepare_topmenu(context):\n    if 'topmenu' not in context:\n        request = context.get('request', None)\n        context['topmenu'] = CachedTopMenu(request.user if request else None)\n    return context['topmenu']\n\n\ndef _deadline_extended_exercise_open(entry, now):\n    personal_deadline = entry.get('personal_deadline')\n    return personal_deadline is not None and entry['opening_time'] <= now <= personal_deadline\n\n\n@register.inclusion_tag(\"course/_course_dropdown_menu.html\", takes_context=True)\ndef course_menu(context):\n    menu = _prepare_topmenu(context)\n    return { \"instances\": menu.courses() }\n\n\n@register.inclusion_tag('course/_group_select.html', takes_context=True)\ndef group_select(context):\n    instance = context.get('instance', None)\n    if not instance:\n        return { 'groups': [] }\n    menu = _prepare_topmenu(context)\n    groups, selected = menu.groups(instance)\n    return {\n        'instance': instance,\n        'groups': groups,\n        'selected': selected,\n    }\n\n\n@register.filter\ndef escape_slashes(string):\n    return str(string).replace('/', '\\/') # noqa: W605\n\n@register.filter\ndef parse_localization(entry):\n    return pick_localized(entry, get_language())\n\n\n@register.filter\ndef list_unselected(langs):\n    listed = list(filter(lambda x: x and x != get_language(), langs.split(\"|\")))\n    return listed\n\n\n@register.filter\ndef is_visible(entry):\n    return CachedContent.is_visible(entry)\n\n\n@register.filter\ndef is_visible_to(entry, user):\n    return entry.is_visible_to(user)\n\n\n@register.filter\ndef is_listed(entry):\n    return CachedContent.is_listed(entry)\n\n\n@register.filter\ndef len_listed(entries):\n    return len([e for e in entries if CachedContent.is_listed(e)])\n\n\n@register.filter\ndef is_in_maintenance(entry):\n    return CachedContent.is_in_maintenance(entry)\n\n\n@register.filter\ndef exercises_open(entry, now):\n    return entry['opening_time'] <= now <= entry['closing_time']\n\n\n@register.filter\ndef deadline_extended_exercise_open(entry, now):\n    return _deadline_extended_exercise_open(entry, now)\n\n\n@register.filter\ndef deadline_extended_exercises_open(entry, now):\n    entries = deepcopy(entry['flatted'])\n    return any(_deadline_extended_exercise_open(entry, now) for entry in entries)\n\n\n@register.filter\ndef exercises_submittable(entry, now):\n    if entry['late_allowed']:\n        return entry['opening_time'] <= now <= entry['late_time']\n    return entry['opening_time'] <= now <= entry['closing_time']\n\n\n@register.filter\ndef has_opened(entry, now):\n    return entry['opening_time'] <= now\n\n\n@register.filter\ndef url(model_object, name=None):\n    if name:\n        return model_object.get_url(name)\n    return model_object.get_display_url()\n\n\n@register.filter\ndef names(profiles):\n    return \", \".join(p.user.get_full_name() for p in profiles)\n\n\n@register.inclusion_tag('course/_avatars.html')\ndef avatars(profiles):\n    return { 'profiles': profiles }\n\n\n@register.inclusion_tag(\"course/_profiles.html\")\ndef profiles(\n        profiles: Union[UserProfile, List[UserProfile], models.QuerySet[UserProfile]],\n        instance: CourseInstance,\n        is_teacher: bool\n        ) -> Dict[str, Any]:\n    if isinstance(profiles, UserProfile):\n        profiles = [profiles]\n    elif isinstance(profiles, models.QuerySet):\n        # Avoid re-fetching the queryset\n        profiles = list(profiles)\n    return {\n        'instance': instance,\n        'profiles': profiles,\n        'is_teacher': is_teacher,\n    }\n\n\n@register.simple_tag\ndef tags(profile, instance):\n    tags = UserTagging.objects.get_all(profile, instance)\n    return mark_safe(' '.join(tag.html_label for tag in tags))\n\n\n@register.filter\ndef enrollment_audience(enrollment_audience_val):\n    # convert enrollment audience Enum value to the string description\n    return CourseInstance.ENROLLMENT_AUDIENCE[enrollment_audience_val]\n\n\n@register.filter\ndef view_content_to(view_content_to_val):\n    # convert \"view content to\" Enum value to the string description\n    return CourseInstance.VIEW_ACCESS[view_content_to_val]\n\n\n@register.filter\ndef is_banned_student(profile, course_instance):\n    return course_instance.is_banned(profile.user)\n", "path": "course/templatetags/course.py"}]}