prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Timezone email
  Format dates in emails in the same language as the email template (Norwegian), and converted to the proper timezone. 
  
  ![image](https://user-images.githubusercontent.com/1467188/34150647-476ffb12-e4a9-11e7-9f17-5b83e0690dad.png)
  
  ![screenshot 19 des 1 2017 10_39_27](https://user-images.githubusercontent.com/1467188/34150870-f9c33536-e4a9-11e7-836e-a3e93ae27f0f.png)
  
  
  
  </issue>
  <code>
  [start of lego/apps/events/notifications.py]
  1 from lego.apps.notifications.constants import (
  2     EVENT_ADMIN_REGISTRATION,
  3     EVENT_ADMIN_UNREGISTRATION,
  4     EVENT_BUMP,
  5     EVENT_PAYMENT_OVERDUE,
  6     EVENT_PAYMENT_OVERDUE_CREATOR,
  7 )
  8 from lego.apps.notifications.notification import Notification
  9 
  10 
  11 class EventBumpNotification(Notification):
  12 
  13     name = EVENT_BUMP
  14 
  15     def generate_mail(self):
  16         event = self.kwargs["event"]
  17 
  18         return self._delay_mail(
  19             to_email=self.user.email,
  20             context={"event": event.title, "name": self.user.full_name, "id": event.id},
  21             subject=f"Du er flyttet opp fra ventelisten på arrangementet {event.title}",
  22             plain_template="events/email/bump.txt",
  23             html_template="events/email/bump.html",
  24         )
  25 
  26     def generate_push(self):
  27         event = self.kwargs["event"]
  28 
  29         return self._delay_push(
  30             template="events/push/bump.txt",
  31             context={"event": event.title},
  32             instance=event,
  33         )
  34 
  35 
  36 class EventPaymentOverdueNotification(Notification):
  37 
  38     name = EVENT_PAYMENT_OVERDUE
  39 
  40     def generate_mail(self):
  41         event = self.kwargs["event"]
  42 
  43         return self._delay_mail(
  44             to_email=self.user.email,
  45             context={
  46                 "event": event.title,
  47                 "name": self.user.full_name,
  48                 "due_date": event.payment_due_date,
  49                 "id": event.id,
  50             },
  51             subject=f"Du har ikke betalt påmeldingen på arrangementet {event.title}",
  52             plain_template="events/email/payment_overdue.txt",
  53             html_template="events/email/payment_overdue.html",
  54         )
  55 
  56     def generate_push(self):
  57         event = self.kwargs["event"]
  58 
  59         return self._delay_push(
  60             template="events/push/payment_overdue.txt",
  61             context={"event": event.title},
  62             instance=event,
  63         )
  64 
  65 
  66 class EventPaymentOverdueCreatorNotification(Notification):
  67 
  68     name = EVENT_PAYMENT_OVERDUE_CREATOR
  69 
  70     def generate_mail(self):
  71         event = self.kwargs["event"]
  72         users = self.kwargs["users"]
  73 
  74         return self._delay_mail(
  75             to_email=self.user.email,
  76             context={
  77                 "event": event.title,
  78                 "users": users,
  79                 "name": self.user.full_name,
  80                 "id": event.id,
  81             },
  82             subject=f"Følgende registrerte har ikke betalt påmeldingen til arrangementet"
  83             f" {event.title}",
  84             plain_template="events/email/payment_overdue_author.txt",
  85             html_template="events/email/payment_overdue_author.html",
  86         )
  87 
  88 
  89 class EventAdminRegistrationNotification(Notification):
  90 
  91     name = EVENT_ADMIN_REGISTRATION
  92 
  93     def generate_mail(self):
  94         event = self.kwargs["event"]
  95         reason = self.kwargs["reason"]
  96 
  97         return self._delay_mail(
  98             to_email=self.user.email,
  99             context={
  100                 "event": event.title,
  101                 "name": self.user.full_name,
  102                 "reason": reason,
  103                 "id": event.id,
  104             },
  105             subject=f"Du har blitt adminpåmeldt på arrangementet {event.title}",
  106             plain_template="events/email/admin_registration.txt",
  107             html_template="events/email/admin_registration.html",
  108         )
  109 
  110     def generate_push(self):
  111         event = self.kwargs["event"]
  112 
  113         return self._delay_push(
  114             template="events/push/admin_registration.txt",
  115             context={"event": event.title},
  116             instance=event,
  117         )
  118 
  119 
  120 class EventAdminUnregistrationNotification(Notification):
  121 
  122     name = EVENT_ADMIN_UNREGISTRATION
  123 
  124     def generate_mail(self):
  125         event = self.kwargs["event"]
  126         creator = self.kwargs["creator"]
  127         reason = self.kwargs["reason"]
  128 
  129         return self._delay_mail(
  130             to_email=self.user.email,
  131             context={
  132                 "event": event.title,
  133                 "creator_name": creator.full_name,
  134                 "creator_email": creator.email,
  135                 "name": self.user.full_name,
  136                 "reason": reason,
  137                 "id": event.id,
  138             },
  139             subject=f"Du har blitt fjernet fra arrangementet {event.title}",
  140             plain_template="events/email/admin_unregistration.txt",
  141             html_template="events/email/admin_unregistration.html",
  142         )
  143 
  144     def generate_push(self):
  145         event = self.kwargs["event"]
  146 
  147         return self._delay_push(
  148             template="events/push/admin_unregistration.txt",
  149             context={"event": event.title},
  150             instance=event,
  151         )
  152
  [end of lego/apps/events/notifications.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/lego/apps/events/notifications.py b/lego/apps/events/notifications.py
  --- a/lego/apps/events/notifications.py
  +++ b/lego/apps/events/notifications.py
  @@ -1,3 +1,7 @@
  +from django.utils import timezone
  +
  +import pytz
  +
   from lego.apps.notifications.constants import (
       EVENT_ADMIN_REGISTRATION,
       EVENT_ADMIN_UNREGISTRATION,
  @@ -40,12 +44,18 @@
       def generate_mail(self):
           event = self.kwargs["event"]
   
  +        date = timezone.localtime(
  +            value=event.payment_due_date, timezone=pytz.timezone("Europe/Oslo")
  +        )
  +
  +        due_date = date.strftime("%d.%m.%y, kl. %H:%M")
  +
           return self._delay_mail(
               to_email=self.user.email,
               context={
                   "event": event.title,
                   "name": self.user.full_name,
  -                "due_date": event.payment_due_date,
  +                "due_date": due_date,
                   "id": event.id,
               },
               subject=f"Du har ikke betalt påmeldingen på arrangementet {event.title}",
  
verification_info: {"golden_diff": "diff --git a/lego/apps/events/notifications.py b/lego/apps/events/notifications.py\n--- a/lego/apps/events/notifications.py\n+++ b/lego/apps/events/notifications.py\n@@ -1,3 +1,7 @@\n+from django.utils import timezone\n+\n+import pytz\n+\n from lego.apps.notifications.constants import (\n     EVENT_ADMIN_REGISTRATION,\n     EVENT_ADMIN_UNREGISTRATION,\n@@ -40,12 +44,18 @@\n     def generate_mail(self):\n         event = self.kwargs[\"event\"]\n \n+        date = timezone.localtime(\n+            value=event.payment_due_date, timezone=pytz.timezone(\"Europe/Oslo\")\n+        )\n+\n+        due_date = date.strftime(\"%d.%m.%y, kl. %H:%M\")\n+\n         return self._delay_mail(\n             to_email=self.user.email,\n             context={\n                 \"event\": event.title,\n                 \"name\": self.user.full_name,\n-                \"due_date\": event.payment_due_date,\n+                \"due_date\": due_date,\n                 \"id\": event.id,\n             },\n             subject=f\"Du har ikke betalt p\u00e5meldingen p\u00e5 arrangementet {event.title}\",\n", "issue": "Timezone email\nFormat dates in emails in the same language as the email template (Norwegian), and converted to the proper timezone. \r\n\r\n![image](https://user-images.githubusercontent.com/1467188/34150647-476ffb12-e4a9-11e7-9f17-5b83e0690dad.png)\r\n\r\n![screenshot 19 des 1 2017 10_39_27](https://user-images.githubusercontent.com/1467188/34150870-f9c33536-e4a9-11e7-836e-a3e93ae27f0f.png)\r\n\r\n\n", "before_files": [{"content": "from lego.apps.notifications.constants import (\n    EVENT_ADMIN_REGISTRATION,\n    EVENT_ADMIN_UNREGISTRATION,\n    EVENT_BUMP,\n    EVENT_PAYMENT_OVERDUE,\n    EVENT_PAYMENT_OVERDUE_CREATOR,\n)\nfrom lego.apps.notifications.notification import Notification\n\n\nclass EventBumpNotification(Notification):\n\n    name = EVENT_BUMP\n\n    def generate_mail(self):\n        event = self.kwargs[\"event\"]\n\n        return self._delay_mail(\n            to_email=self.user.email,\n            context={\"event\": event.title, \"name\": self.user.full_name, \"id\": event.id},\n            subject=f\"Du er flyttet opp fra ventelisten p\u00e5 arrangementet {event.title}\",\n            plain_template=\"events/email/bump.txt\",\n            html_template=\"events/email/bump.html\",\n        )\n\n    def generate_push(self):\n        event = self.kwargs[\"event\"]\n\n        return self._delay_push(\n            template=\"events/push/bump.txt\",\n            context={\"event\": event.title},\n            instance=event,\n        )\n\n\nclass EventPaymentOverdueNotification(Notification):\n\n    name = EVENT_PAYMENT_OVERDUE\n\n    def generate_mail(self):\n        event = self.kwargs[\"event\"]\n\n        return self._delay_mail(\n            to_email=self.user.email,\n            context={\n                \"event\": event.title,\n                \"name\": self.user.full_name,\n                \"due_date\": event.payment_due_date,\n                \"id\": event.id,\n            },\n            subject=f\"Du har ikke betalt p\u00e5meldingen p\u00e5 arrangementet {event.title}\",\n            plain_template=\"events/email/payment_overdue.txt\",\n            html_template=\"events/email/payment_overdue.html\",\n        )\n\n    def generate_push(self):\n        event = self.kwargs[\"event\"]\n\n        return self._delay_push(\n            template=\"events/push/payment_overdue.txt\",\n            context={\"event\": event.title},\n            instance=event,\n        )\n\n\nclass EventPaymentOverdueCreatorNotification(Notification):\n\n    name = EVENT_PAYMENT_OVERDUE_CREATOR\n\n    def generate_mail(self):\n        event = self.kwargs[\"event\"]\n        users = self.kwargs[\"users\"]\n\n        return self._delay_mail(\n            to_email=self.user.email,\n            context={\n                \"event\": event.title,\n                \"users\": users,\n                \"name\": self.user.full_name,\n                \"id\": event.id,\n            },\n            subject=f\"F\u00f8lgende registrerte har ikke betalt p\u00e5meldingen til arrangementet\"\n            f\" {event.title}\",\n            plain_template=\"events/email/payment_overdue_author.txt\",\n            html_template=\"events/email/payment_overdue_author.html\",\n        )\n\n\nclass EventAdminRegistrationNotification(Notification):\n\n    name = EVENT_ADMIN_REGISTRATION\n\n    def generate_mail(self):\n        event = self.kwargs[\"event\"]\n        reason = self.kwargs[\"reason\"]\n\n        return self._delay_mail(\n            to_email=self.user.email,\n            context={\n                \"event\": event.title,\n                \"name\": self.user.full_name,\n                \"reason\": reason,\n                \"id\": event.id,\n            },\n            subject=f\"Du har blitt adminp\u00e5meldt p\u00e5 arrangementet {event.title}\",\n            plain_template=\"events/email/admin_registration.txt\",\n            html_template=\"events/email/admin_registration.html\",\n        )\n\n    def generate_push(self):\n        event = self.kwargs[\"event\"]\n\n        return self._delay_push(\n            template=\"events/push/admin_registration.txt\",\n            context={\"event\": event.title},\n            instance=event,\n        )\n\n\nclass EventAdminUnregistrationNotification(Notification):\n\n    name = EVENT_ADMIN_UNREGISTRATION\n\n    def generate_mail(self):\n        event = self.kwargs[\"event\"]\n        creator = self.kwargs[\"creator\"]\n        reason = self.kwargs[\"reason\"]\n\n        return self._delay_mail(\n            to_email=self.user.email,\n            context={\n                \"event\": event.title,\n                \"creator_name\": creator.full_name,\n                \"creator_email\": creator.email,\n                \"name\": self.user.full_name,\n                \"reason\": reason,\n                \"id\": event.id,\n            },\n            subject=f\"Du har blitt fjernet fra arrangementet {event.title}\",\n            plain_template=\"events/email/admin_unregistration.txt\",\n            html_template=\"events/email/admin_unregistration.html\",\n        )\n\n    def generate_push(self):\n        event = self.kwargs[\"event\"]\n\n        return self._delay_push(\n            template=\"events/push/admin_unregistration.txt\",\n            context={\"event\": event.title},\n            instance=event,\n        )\n", "path": "lego/apps/events/notifications.py"}]}