prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Crash on listing current sponsors
  When opening the sponsors view (with some sponsors and sponsor periods created) we get a crash.
  
  http://changelog.inasafe.org/en/qgis/sponsor/list/
  
  Sentry info:
  
  http://sentry.kartoza.com/kartoza/projecta-live/group/5848/
  
  Relevant code.
  
  ```
      def current_sponsor(self):
          today = datetime.datetime.now().replace(tzinfo=utc)
          end = self.end_date.replace(tzinfo=utc)  # <-- offending line
          if end < today:
              return False
          else:
              return True
  ```
  
  
  </issue>
  <code>
  [start of django_project/changes/models/sponsorship_period.py]
  1 __author__ = 'rischan'
  2 
  3 import string
  4 import random
  5 from django.utils import timezone
  6 from django.core.urlresolvers import reverse
  7 from django.utils.text import slugify
  8 from core.settings.contrib import STOP_WORDS
  9 from django.db import models
  10 from django.utils.translation import ugettext_lazy as _
  11 from django.contrib.auth.models import User
  12 
  13 
  14 class ApprovedSponsorshipPeriodManager(models.Manager):
  15     """Custom sponsor manager that shows only approved records."""
  16 
  17     def get_queryset(self):
  18         """Query set generator"""
  19         return super(
  20             ApprovedSponsorshipPeriodManager, self).get_queryset().filter(
  21                 approved=True)
  22 
  23 
  24 class UnapprovedSponsorshipPeriodManager(models.Manager):
  25     """Custom sponsor manager that shows only unapproved records."""
  26 
  27     def get_queryset(self):
  28         """Query set generator"""
  29         return super(
  30             UnapprovedSponsorshipPeriodManager, self).get_queryset().filter(
  31                 approved=False)
  32 
  33 
  34 class SponsorshipPeriod(models.Model):
  35     """A sponsorship period model e.g. gui, backend, web site etc."""
  36 
  37     start_date = models.DateField(
  38         _("Start date"),
  39         help_text='Start date of sponsorship period',
  40         default=timezone.now)
  41 
  42     end_date = models.DateField(
  43         _("End date"),
  44         help_text='End date of sponsorship period',
  45         default=timezone.now)
  46 
  47     approved = models.BooleanField(
  48         help_text=_(
  49             'Whether this sponsorship period has been approved for use by '
  50             'the project owner.'),
  51         default=False
  52     )
  53 
  54     author = models.ForeignKey(User)
  55     slug = models.SlugField()
  56     project = models.ForeignKey('base.Project')
  57     objects = models.Manager()
  58     approved_objects = ApprovedSponsorshipPeriodManager()
  59     unapproved_objects = UnapprovedSponsorshipPeriodManager()
  60     sponsor = models.ForeignKey(
  61             'Sponsor',
  62             help_text='Input the sponsor name',
  63     )
  64     sponsorshiplevel = models.ForeignKey(
  65             'SponsorshipLevel',
  66             help_text='This level take from Sponsorship Level, '
  67             'you can add it by using Sponsorship Level menu',
  68     )
  69     # noinspection PyClassicStyleClass
  70 
  71     class Meta:
  72         """Meta options for the sponsor class."""
  73         unique_together = (
  74             ('project', 'slug')
  75         )
  76         app_label = 'changes'
  77         ordering = ['start_date']
  78 
  79     def save(self, *args, **kwargs):
  80 
  81         if not self.pk:
  82             name = self.slug_generator()
  83             words = name.split()
  84             filtered_words = [t for t in words if t.lower() not in STOP_WORDS]
  85             new_list = ' '.join(filtered_words)
  86             self.slug = slugify(new_list)[:50]
  87         super(SponsorshipPeriod, self).save(*args, **kwargs)
  88 
  89     def slug_generator(self, size=6, chars=string.ascii_lowercase):
  90         return ''.join(random.choice(chars) for _ in range(size))
  91 
  92     def __unicode__(self):
  93         return u'%s - %s : %s' % (
  94             self.start_date,
  95             self.end_date
  96         )
  97 
  98     def get_absolute_url(self):
  99         return reverse('sponsorshipperiod-detail', kwargs={
  100             'slug': self.slug,
  101             'project_slug': self.project.slug
  102         })
  103 
  104     def current_sponsor(self):
  105         today = timezone.now()
  106         end = self.end_date
  107         if end < today:
  108             return False
  109         else:
  110             return True
  111
  [end of django_project/changes/models/sponsorship_period.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/django_project/changes/models/sponsorship_period.py b/django_project/changes/models/sponsorship_period.py
  --- a/django_project/changes/models/sponsorship_period.py
  +++ b/django_project/changes/models/sponsorship_period.py
  @@ -1,15 +1,19 @@
  -__author__ = 'rischan'
  +# coding=utf-8
   
   import string
   import random
  +import datetime
   from django.utils import timezone
   from django.core.urlresolvers import reverse
   from django.utils.text import slugify
  +# noinspection PyPackageRequirements
   from core.settings.contrib import STOP_WORDS
   from django.db import models
   from django.utils.translation import ugettext_lazy as _
   from django.contrib.auth.models import User
   
  +__author__ = 'rischan'
  +
   
   class ApprovedSponsorshipPeriodManager(models.Manager):
       """Custom sponsor manager that shows only approved records."""
  @@ -57,14 +61,16 @@
       objects = models.Manager()
       approved_objects = ApprovedSponsorshipPeriodManager()
       unapproved_objects = UnapprovedSponsorshipPeriodManager()
  +    # noinspection PyUnresolvedReferences
       sponsor = models.ForeignKey(
  -            'Sponsor',
  -            help_text='Input the sponsor name',
  +        'Sponsor',
  +        help_text='Input the sponsor name',
       )
  +    # noinspection PyUnresolvedReferences
       sponsorshiplevel = models.ForeignKey(
  -            'SponsorshipLevel',
  -            help_text='This level take from Sponsorship Level, '
  -            'you can add it by using Sponsorship Level menu',
  +        'SponsorshipLevel',
  +        help_text='This level take from Sponsorship Level, '
  +        'you can add it by using Sponsorship Level menu',
       )
       # noinspection PyClassicStyleClass
   
  @@ -86,11 +92,13 @@
               self.slug = slugify(new_list)[:50]
           super(SponsorshipPeriod, self).save(*args, **kwargs)
   
  -    def slug_generator(self, size=6, chars=string.ascii_lowercase):
  +    @staticmethod
  +    def slug_generator(size=6, chars=string.ascii_lowercase):
           return ''.join(random.choice(chars) for _ in range(size))
   
       def __unicode__(self):
           return u'%s - %s : %s' % (
  +            self.sponsor.name,
               self.start_date,
               self.end_date
           )
  @@ -102,7 +110,7 @@
           })
   
       def current_sponsor(self):
  -        today = timezone.now()
  +        today = datetime.datetime.now().date()
           end = self.end_date
           if end < today:
               return False
  
verification_info: {"golden_diff": "diff --git a/django_project/changes/models/sponsorship_period.py b/django_project/changes/models/sponsorship_period.py\n--- a/django_project/changes/models/sponsorship_period.py\n+++ b/django_project/changes/models/sponsorship_period.py\n@@ -1,15 +1,19 @@\n-__author__ = 'rischan'\n+# coding=utf-8\n \n import string\n import random\n+import datetime\n from django.utils import timezone\n from django.core.urlresolvers import reverse\n from django.utils.text import slugify\n+# noinspection PyPackageRequirements\n from core.settings.contrib import STOP_WORDS\n from django.db import models\n from django.utils.translation import ugettext_lazy as _\n from django.contrib.auth.models import User\n \n+__author__ = 'rischan'\n+\n \n class ApprovedSponsorshipPeriodManager(models.Manager):\n     \"\"\"Custom sponsor manager that shows only approved records.\"\"\"\n@@ -57,14 +61,16 @@\n     objects = models.Manager()\n     approved_objects = ApprovedSponsorshipPeriodManager()\n     unapproved_objects = UnapprovedSponsorshipPeriodManager()\n+    # noinspection PyUnresolvedReferences\n     sponsor = models.ForeignKey(\n-            'Sponsor',\n-            help_text='Input the sponsor name',\n+        'Sponsor',\n+        help_text='Input the sponsor name',\n     )\n+    # noinspection PyUnresolvedReferences\n     sponsorshiplevel = models.ForeignKey(\n-            'SponsorshipLevel',\n-            help_text='This level take from Sponsorship Level, '\n-            'you can add it by using Sponsorship Level menu',\n+        'SponsorshipLevel',\n+        help_text='This level take from Sponsorship Level, '\n+        'you can add it by using Sponsorship Level menu',\n     )\n     # noinspection PyClassicStyleClass\n \n@@ -86,11 +92,13 @@\n             self.slug = slugify(new_list)[:50]\n         super(SponsorshipPeriod, self).save(*args, **kwargs)\n \n-    def slug_generator(self, size=6, chars=string.ascii_lowercase):\n+    @staticmethod\n+    def slug_generator(size=6, chars=string.ascii_lowercase):\n         return ''.join(random.choice(chars) for _ in range(size))\n \n     def __unicode__(self):\n         return u'%s - %s : %s' % (\n+            self.sponsor.name,\n             self.start_date,\n             self.end_date\n         )\n@@ -102,7 +110,7 @@\n         })\n \n     def current_sponsor(self):\n-        today = timezone.now()\n+        today = datetime.datetime.now().date()\n         end = self.end_date\n         if end < today:\n             return False\n", "issue": "Crash on listing current sponsors\nWhen opening the sponsors view (with some sponsors and sponsor periods created) we get a crash.\n\nhttp://changelog.inasafe.org/en/qgis/sponsor/list/\n\nSentry info:\n\nhttp://sentry.kartoza.com/kartoza/projecta-live/group/5848/\n\nRelevant code.\n\n```\n    def current_sponsor(self):\n        today = datetime.datetime.now().replace(tzinfo=utc)\n        end = self.end_date.replace(tzinfo=utc)  # <-- offending line\n        if end < today:\n            return False\n        else:\n            return True\n```\n\n", "before_files": [{"content": "__author__ = 'rischan'\n\nimport string\nimport random\nfrom django.utils import timezone\nfrom django.core.urlresolvers import reverse\nfrom django.utils.text import slugify\nfrom core.settings.contrib import STOP_WORDS\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib.auth.models import User\n\n\nclass ApprovedSponsorshipPeriodManager(models.Manager):\n    \"\"\"Custom sponsor manager that shows only approved records.\"\"\"\n\n    def get_queryset(self):\n        \"\"\"Query set generator\"\"\"\n        return super(\n            ApprovedSponsorshipPeriodManager, self).get_queryset().filter(\n                approved=True)\n\n\nclass UnapprovedSponsorshipPeriodManager(models.Manager):\n    \"\"\"Custom sponsor manager that shows only unapproved records.\"\"\"\n\n    def get_queryset(self):\n        \"\"\"Query set generator\"\"\"\n        return super(\n            UnapprovedSponsorshipPeriodManager, self).get_queryset().filter(\n                approved=False)\n\n\nclass SponsorshipPeriod(models.Model):\n    \"\"\"A sponsorship period model e.g. gui, backend, web site etc.\"\"\"\n\n    start_date = models.DateField(\n        _(\"Start date\"),\n        help_text='Start date of sponsorship period',\n        default=timezone.now)\n\n    end_date = models.DateField(\n        _(\"End date\"),\n        help_text='End date of sponsorship period',\n        default=timezone.now)\n\n    approved = models.BooleanField(\n        help_text=_(\n            'Whether this sponsorship period has been approved for use by '\n            'the project owner.'),\n        default=False\n    )\n\n    author = models.ForeignKey(User)\n    slug = models.SlugField()\n    project = models.ForeignKey('base.Project')\n    objects = models.Manager()\n    approved_objects = ApprovedSponsorshipPeriodManager()\n    unapproved_objects = UnapprovedSponsorshipPeriodManager()\n    sponsor = models.ForeignKey(\n            'Sponsor',\n            help_text='Input the sponsor name',\n    )\n    sponsorshiplevel = models.ForeignKey(\n            'SponsorshipLevel',\n            help_text='This level take from Sponsorship Level, '\n            'you can add it by using Sponsorship Level menu',\n    )\n    # noinspection PyClassicStyleClass\n\n    class Meta:\n        \"\"\"Meta options for the sponsor class.\"\"\"\n        unique_together = (\n            ('project', 'slug')\n        )\n        app_label = 'changes'\n        ordering = ['start_date']\n\n    def save(self, *args, **kwargs):\n\n        if not self.pk:\n            name = self.slug_generator()\n            words = name.split()\n            filtered_words = [t for t in words if t.lower() not in STOP_WORDS]\n            new_list = ' '.join(filtered_words)\n            self.slug = slugify(new_list)[:50]\n        super(SponsorshipPeriod, self).save(*args, **kwargs)\n\n    def slug_generator(self, size=6, chars=string.ascii_lowercase):\n        return ''.join(random.choice(chars) for _ in range(size))\n\n    def __unicode__(self):\n        return u'%s - %s : %s' % (\n            self.start_date,\n            self.end_date\n        )\n\n    def get_absolute_url(self):\n        return reverse('sponsorshipperiod-detail', kwargs={\n            'slug': self.slug,\n            'project_slug': self.project.slug\n        })\n\n    def current_sponsor(self):\n        today = timezone.now()\n        end = self.end_date\n        if end < today:\n            return False\n        else:\n            return True\n", "path": "django_project/changes/models/sponsorship_period.py"}]}