prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Alergies should be tied to names in pdf
  Request from arrKom among others. 
  
  
  </issue>
  <code>
  [start of apps/events/pdf_generator.py]
  1 # -*- coding: utf-8 -*-
  2 from django.contrib.auth.decorators import login_required, user_passes_test
  3 
  4 from pdfdocument.utils import pdf_response
  5 from reportlab.platypus import TableStyle, Paragraph
  6 from reportlab.lib import colors
  7 from reportlab.lib.styles import getSampleStyleSheet
  8 
  9 class EventPDF:
  10 
  11     event = None
  12     attendees = None
  13     waiters = None
  14     attendee_table_data = None
  15     waiters_table_data = None
  16     allergies_table_data = None
  17 
  18     def __init__(self, event):
  19         self.event = event
  20         self.attendees = sorted(event.attendance_event.attendees.all()[:event.attendance_event.max_capacity], key=lambda attendee: attendee.user.last_name)
  21         self.waiters = event.wait_list
  22         self.attendee_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon'), ]
  23         self.waiters_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon'), ]
  24         self.allergies_table_data = ()
  25 
  26         self.create_attendees_table_data()
  27         self.create_waiters_table_data()
  28         
  29 
  30     # Create table data for attendees with a spot
  31     def create_attendees_table_data(self):
  32 
  33         for attendee in self.attendees:
  34             user = attendee.user
  35             self.attendee_table_data.append((create_body_text("%s, %s" % (user.last_name, user.first_name)),
  36                                              user.year, create_body_text(user.get_field_of_study_display()),
  37                                              user.phone_number))
  38 
  39             if user.allergies:
  40                 self.allergies_table_data = self.allergies_table_data + (user.allergies,)
  41 
  42     # Create table data for attendees waiting for a spot
  43     def create_waiters_table_data(self):
  44 
  45         for attendee in self.waiters:
  46             user = attendee.user
  47             self.waiters_table_data.append((create_body_text("%s, %s" % (user.last_name, user.first_name)),
  48                                             user.year, create_body_text(user.get_field_of_study_display()),
  49                                             user.phone_number))
  50 
  51             if user.allergies:
  52                 self.allergies_table_data = self.allergies_table_data + (user.allergies,)
  53 
  54     def attendee_column_widths(self):
  55         return (200, 40, 170, 60)
  56 
  57     def allergies_column_widths(self):
  58         return (200, 200)
  59 
  60     def render_pdf(self):
  61         pdf, response = pdf_response(self.event.title + u" attendees")
  62         pdf.init_report()
  63 
  64         pdf.p(self.event.title, style=create_paragraph_style(font_size=18))
  65         pdf.spacer(10)
  66         pdf.p(self.event.event_start.strftime('%d. %B %Y'), create_paragraph_style(font_size=9))
  67         pdf.spacer(height=25)
  68 
  69         pdf.p(u"Påmeldte", style=create_paragraph_style(font_size=14))
  70         pdf.spacer(height=20)
  71         pdf.table(self.attendee_table_data, self.attendee_column_widths(), style=get_table_style())
  72         pdf.spacer(height=25)
  73 
  74         pdf.p(u"Venteliste", style=create_paragraph_style(font_size=14))
  75         pdf.spacer(height=20)
  76         pdf.table(self.waiters_table_data, self.attendee_column_widths(), style=get_table_style())
  77         pdf.spacer(height=25)
  78 
  79         pdf.p(u"Allergier", style=create_paragraph_style(font_size=14))
  80         pdf.spacer(height=12)
  81         pdf.ul(self.allergies_table_data)
  82 
  83         pdf.generate()
  84         return response
  85 
  86 
  87 # Table style for framed table with grids
  88 def get_table_style():
  89     return TableStyle(
  90         [
  91             ('GRID',(0,0),(-1,-1),0.5,colors.grey),
  92             ('BOX',(0,0),(-1,-1),1,colors.black),
  93         ]
  94     )
  95 
  96 # Normal paragraph
  97 def create_paragraph_style(font_name='Helvetica', font_size=10, color=colors.black):
  98     style = getSampleStyleSheet()['Normal']
  99     style.fontSize = font_size
  100     style.fontName = font_name
  101     style.textColor = color
  102 
  103     return style
  104 
  105 # Paragraph with word-wrapping, useful for tables
  106 def create_body_text(text, font_name='Helvetica', font_size=10, color=colors.black):
  107     style = getSampleStyleSheet()['BodyText']
  108     style.fontSize = font_size
  109     style.fontName = font_name
  110     style.textColor = color
  111 
  112     return Paragraph(text, style=style)
  [end of apps/events/pdf_generator.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/apps/events/pdf_generator.py b/apps/events/pdf_generator.py
  --- a/apps/events/pdf_generator.py
  +++ b/apps/events/pdf_generator.py
  @@ -19,8 +19,8 @@
           self.event = event
           self.attendees = sorted(event.attendance_event.attendees.all()[:event.attendance_event.max_capacity], key=lambda attendee: attendee.user.last_name)
           self.waiters = event.wait_list
  -        self.attendee_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon'), ]
  -        self.waiters_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon'), ]
  +        self.attendee_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon', u'Allergier'), ]
  +        self.waiters_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon',  u'Allergier'), ]
           self.allergies_table_data = ()
   
           self.create_attendees_table_data()
  @@ -34,7 +34,7 @@
               user = attendee.user
               self.attendee_table_data.append((create_body_text("%s, %s" % (user.last_name, user.first_name)),
                                                user.year, create_body_text(user.get_field_of_study_display()),
  -                                             user.phone_number))
  +                                             user.phone_number, user.allergies))
   
               if user.allergies:
                   self.allergies_table_data = self.allergies_table_data + (user.allergies,)
  @@ -46,13 +46,13 @@
               user = attendee.user
               self.waiters_table_data.append((create_body_text("%s, %s" % (user.last_name, user.first_name)),
                                               user.year, create_body_text(user.get_field_of_study_display()),
  -                                            user.phone_number))
  +                                            user.phone_number, user.allergies))
   
               if user.allergies:
                   self.allergies_table_data = self.allergies_table_data + (user.allergies,)
   
       def attendee_column_widths(self):
  -        return (200, 40, 170, 60)
  +        return (150, 40, 170, 60, 100)
   
       def allergies_column_widths(self):
           return (200, 200)
  
verification_info: {"golden_diff": "diff --git a/apps/events/pdf_generator.py b/apps/events/pdf_generator.py\n--- a/apps/events/pdf_generator.py\n+++ b/apps/events/pdf_generator.py\n@@ -19,8 +19,8 @@\n         self.event = event\n         self.attendees = sorted(event.attendance_event.attendees.all()[:event.attendance_event.max_capacity], key=lambda attendee: attendee.user.last_name)\n         self.waiters = event.wait_list\n-        self.attendee_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon'), ]\n-        self.waiters_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon'), ]\n+        self.attendee_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon', u'Allergier'), ]\n+        self.waiters_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon',  u'Allergier'), ]\n         self.allergies_table_data = ()\n \n         self.create_attendees_table_data()\n@@ -34,7 +34,7 @@\n             user = attendee.user\n             self.attendee_table_data.append((create_body_text(\"%s, %s\" % (user.last_name, user.first_name)),\n                                              user.year, create_body_text(user.get_field_of_study_display()),\n-                                             user.phone_number))\n+                                             user.phone_number, user.allergies))\n \n             if user.allergies:\n                 self.allergies_table_data = self.allergies_table_data + (user.allergies,)\n@@ -46,13 +46,13 @@\n             user = attendee.user\n             self.waiters_table_data.append((create_body_text(\"%s, %s\" % (user.last_name, user.first_name)),\n                                             user.year, create_body_text(user.get_field_of_study_display()),\n-                                            user.phone_number))\n+                                            user.phone_number, user.allergies))\n \n             if user.allergies:\n                 self.allergies_table_data = self.allergies_table_data + (user.allergies,)\n \n     def attendee_column_widths(self):\n-        return (200, 40, 170, 60)\n+        return (150, 40, 170, 60, 100)\n \n     def allergies_column_widths(self):\n         return (200, 200)\n", "issue": "Alergies should be tied to names in pdf\nRequest from arrKom among others. \n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom django.contrib.auth.decorators import login_required, user_passes_test\n\nfrom pdfdocument.utils import pdf_response\nfrom reportlab.platypus import TableStyle, Paragraph\nfrom reportlab.lib import colors\nfrom reportlab.lib.styles import getSampleStyleSheet\n\nclass EventPDF:\n\n    event = None\n    attendees = None\n    waiters = None\n    attendee_table_data = None\n    waiters_table_data = None\n    allergies_table_data = None\n\n    def __init__(self, event):\n        self.event = event\n        self.attendees = sorted(event.attendance_event.attendees.all()[:event.attendance_event.max_capacity], key=lambda attendee: attendee.user.last_name)\n        self.waiters = event.wait_list\n        self.attendee_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon'), ]\n        self.waiters_table_data = [(u'Navn', u'Klasse', u'Studie', u'Telefon'), ]\n        self.allergies_table_data = ()\n\n        self.create_attendees_table_data()\n        self.create_waiters_table_data()\n        \n\n    # Create table data for attendees with a spot\n    def create_attendees_table_data(self):\n\n        for attendee in self.attendees:\n            user = attendee.user\n            self.attendee_table_data.append((create_body_text(\"%s, %s\" % (user.last_name, user.first_name)),\n                                             user.year, create_body_text(user.get_field_of_study_display()),\n                                             user.phone_number))\n\n            if user.allergies:\n                self.allergies_table_data = self.allergies_table_data + (user.allergies,)\n\n    # Create table data for attendees waiting for a spot\n    def create_waiters_table_data(self):\n\n        for attendee in self.waiters:\n            user = attendee.user\n            self.waiters_table_data.append((create_body_text(\"%s, %s\" % (user.last_name, user.first_name)),\n                                            user.year, create_body_text(user.get_field_of_study_display()),\n                                            user.phone_number))\n\n            if user.allergies:\n                self.allergies_table_data = self.allergies_table_data + (user.allergies,)\n\n    def attendee_column_widths(self):\n        return (200, 40, 170, 60)\n\n    def allergies_column_widths(self):\n        return (200, 200)\n\n    def render_pdf(self):\n        pdf, response = pdf_response(self.event.title + u\" attendees\")\n        pdf.init_report()\n\n        pdf.p(self.event.title, style=create_paragraph_style(font_size=18))\n        pdf.spacer(10)\n        pdf.p(self.event.event_start.strftime('%d. %B %Y'), create_paragraph_style(font_size=9))\n        pdf.spacer(height=25)\n\n        pdf.p(u\"P\u00e5meldte\", style=create_paragraph_style(font_size=14))\n        pdf.spacer(height=20)\n        pdf.table(self.attendee_table_data, self.attendee_column_widths(), style=get_table_style())\n        pdf.spacer(height=25)\n\n        pdf.p(u\"Venteliste\", style=create_paragraph_style(font_size=14))\n        pdf.spacer(height=20)\n        pdf.table(self.waiters_table_data, self.attendee_column_widths(), style=get_table_style())\n        pdf.spacer(height=25)\n\n        pdf.p(u\"Allergier\", style=create_paragraph_style(font_size=14))\n        pdf.spacer(height=12)\n        pdf.ul(self.allergies_table_data)\n\n        pdf.generate()\n        return response\n\n\n# Table style for framed table with grids\ndef get_table_style():\n    return TableStyle(\n        [\n            ('GRID',(0,0),(-1,-1),0.5,colors.grey),\n            ('BOX',(0,0),(-1,-1),1,colors.black),\n        ]\n    )\n\n# Normal paragraph\ndef create_paragraph_style(font_name='Helvetica', font_size=10, color=colors.black):\n    style = getSampleStyleSheet()['Normal']\n    style.fontSize = font_size\n    style.fontName = font_name\n    style.textColor = color\n\n    return style\n\n# Paragraph with word-wrapping, useful for tables\ndef create_body_text(text, font_name='Helvetica', font_size=10, color=colors.black):\n    style = getSampleStyleSheet()['BodyText']\n    style.fontSize = font_size\n    style.fontName = font_name\n    style.textColor = color\n\n    return Paragraph(text, style=style)", "path": "apps/events/pdf_generator.py"}]}