We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Reshape html summary in atom/rss sponsors feed
Currently the sponsor items are looking like this:

```
<div>
<img
src="/media/images/projects/b9c08a00a74cba8e406e97f94a1f90595f5ac39d.png"
width="300px">
</div>
<p><span>Sponsorship level: Gold : 9000 EUR</span>
<br/>
<span>Sponsorship period: 21 June 2017 - 21 June 2018</span><br/>
<span>Amount sponsored: EUR 9000.00<span>
</p>
```

Is it (easy) possible in this html to change the following:
- make the img-element a full url (as I use the feed in qgis.org and it is easiest to just retrieve the images from changelog.qgis.org
- add some classes to the img-element and the p-element as then I can do some more styling.

An example:

```
<div>
<img src="http://changelog.qgis.org/media/images/projects/..5ac39d.png"
class="sponsor_img gold">
</div>
<p class="sponsor_body gold">
<span>Sponsorship level: Gold : 9000 EUR</span>
<br/>
<span>Sponsorship period: 21 June 2017 - 21 June 2018</span>
<br/>
<span>Amount sponsored: EUR 9000.00<span>
</p>
```



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `django_project/changes/feeds/sponsor.py`
Content:
```
1 # coding=utf-8
2 
3 __author__ = 'Anita Hapsari <anita@kartoza.com>'
4 __date__ = '23/10/2017'
5 
6 from django.conf import settings
7 from django.contrib.syndication.views import Feed
8 from django.utils.feedgenerator import Atom1Feed
9 from django.shortcuts import get_object_or_404
10 from base.models.project import Project
11 from changes.models.sponsorship_period import SponsorshipPeriod
12 from changes.feeds.json_rss_feed import JSONFeed
13 
14 
15 # noinspection PyMethodMayBeStatic
16 class RssSponsorFeed(Feed):
17     """RSS Feed class for sponsor."""
18 
19     def get_object(self, request, *args, **kwargs):
20         """Return project object that matches the project_slug.
21 
22         :param request: The incoming HTTP request object
23         :type request: HttpRequest
24 
25         :param args: Positional arguments
26         :type args: tuple
27 
28         :param kwargs: Keyword arguments
29         :type kwargs: dict
30 
31         :returns: A project
32         :rtype: Project
33 
34         :raises: Http404
35         """
36         project_slug = kwargs.get('project_slug', None)
37         return get_object_or_404(Project, slug=project_slug)
38 
39     def title(self, obj):
40         """Return a title for the RSS.
41 
42          :param obj: A project
43          :type obj: Project
44 
45          :returns: Title of the RSS Feed.
46          :rtype: str
47          """
48         return 'RSS Sponsor of %s Project' % obj.name
49 
50     def description(self, obj):
51         """Return a description for the RSS.
52 
53          :param obj: A project
54          :type obj: Project
55 
56          :returns: Description of the RSS Feed.
57          :rtype: str
58          """
59         return 'These are the latest sponsor of %s project.' % obj.name
60 
61     def link(self, obj):
62         """Return the url of the latest sponsor.
63 
64         :param obj: Latest sponsor of a project
65         :type obj: SponsorshipPeriod
66 
67         :returns: Url of the latest sponsor.
68         :rtype: str
69         """
70         return obj.get_absolute_url()
71 
72     def items(self, obj):
73         """Return latest sponsors of the project.
74 
75         :param obj: A project
76         :type obj: Project
77 
78         :returns: List of latest sponsor of a project
79         :rtype: list
80         """
81         return SponsorshipPeriod.objects.filter(
82             project=obj).order_by('-sponsorship_level__value', '-end_date')
83 
84     def item_title(self, item):
85         """Return the title of the sponsor.
86 
87         :param item: Sponsorship period object of a project
88         :type item: Sponsorship period
89 
90         :returns: name of the sponsor
91         :rtype: str
92         """
93         return item.sponsor.name
94 
95     def item_description(self, item):
96         """Return the description of the sponsor.
97 
98         :param item: Sponsorship period object of a project
99         :type item: Sponsorship period
100 
101         :returns: description of the sponsor
102         :rtype: str
103         """
104         data = {
105             'media_url': settings.MEDIA_URL,
106             'sponsor_logo': item.sponsor.logo,
107             'sponsor_level': item.sponsorship_level,
108             'start_date': item.start_date.strftime('%d %B %Y'),
109             'end_date': item.end_date.strftime('%d %B %Y'),
110             'currency': item.currency,
111             'amount_sponsored': item.amount_sponsored,
112         }
113 
114         descriptions = \
115             '<div>' \
116             '<img src="{media_url}{sponsor_logo}" width="300px"></div>' \
117             '<p><span>Sponsorship level: {sponsor_level}</span><br/>' \
118             '<span>Sponsorship period: {start_date} - {end_date}</span><br/>' \
119             '<span>Amount sponsored: {currency} {amount_sponsored}<span></p>'\
120             .format(**data)
121         return descriptions
122 
123     def item_extra_kwargs(self, item):
124         return {'image_url': item.sponsor.logo.url}
125 
126 
127 
128 class AtomSponsorFeed(RssSponsorFeed):
129     """Atom Feed class for sponsor."""
130 
131     feed_type = Atom1Feed
132     subtitle = RssSponsorFeed.description
133 
134 
135 class JSONSponsorFeed(RssSponsorFeed):
136     """JSON Feed class for sponsor."""
137 
138     feed_type = JSONFeed
139
```
--- 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()

```

diff --git a/django_project/changes/feeds/sponsor.py b/django_project/changes/feeds/sponsor.py
--- a/django_project/changes/feeds/sponsor.py
+++ b/django_project/changes/feeds/sponsor.py
@@ -3,8 +3,9 @@
 __author__ = 'Anita Hapsari <anita@kartoza.com>'
 __date__ = '23/10/2017'
 
-from django.conf import settings
+import datetime
 from django.contrib.syndication.views import Feed
+from django.core.urlresolvers import reverse
 from django.utils.feedgenerator import Atom1Feed
 from django.shortcuts import get_object_or_404
 from base.models.project import Project
@@ -34,6 +35,7 @@
         :raises: Http404
         """
         project_slug = kwargs.get('project_slug', None)
+        self.domain_path_url = request.build_absolute_uri(reverse('home'))
         return get_object_or_404(Project, slug=project_slug)
 
     def title(self, obj):
@@ -78,8 +80,10 @@
         :returns: List of latest sponsor of a project
         :rtype: list
         """
+        today = datetime.datetime.now().date()
         return SponsorshipPeriod.objects.filter(
-            project=obj).order_by('-sponsorship_level__value', '-end_date')
+            project=obj, end_date__gte=today
+        ).order_by('-sponsorship_level__value', '-end_date')
 
     def item_title(self, item):
         """Return the title of the sponsor.
@@ -101,20 +105,26 @@
         :returns: description of the sponsor
         :rtype: str
         """
+        level_class = str(item.sponsorship_level.name).decode('utf-8').lower()
+        head, sep, tail = self.domain_path_url.partition('/en/')
+
         data = {
-            'media_url': settings.MEDIA_URL,
-            'sponsor_logo': item.sponsor.logo,
+            'domain': head,
+            'sponsor_logo': item.sponsor.logo.url,
             'sponsor_level': item.sponsorship_level,
             'start_date': item.start_date.strftime('%d %B %Y'),
             'end_date': item.end_date.strftime('%d %B %Y'),
             'currency': item.currency,
             'amount_sponsored': item.amount_sponsored,
+            'sponsor_class': level_class,
         }
 
         descriptions = \
             '<div>' \
-            '<img src="{media_url}{sponsor_logo}" width="300px"></div>' \
-            '<p><span>Sponsorship level: {sponsor_level}</span><br/>' \
+            '<img class="sponsor_img {sponsor_class}" ' \
+            'src="{domain}{sponsor_logo}" width="300px"></div>' \
+            '<p class="sponsor_body {sponsor_class}">' \
+            '<span>Sponsorship level: {sponsor_level}</span><br/>' \
             '<span>Sponsorship period: {start_date} - {end_date}</span><br/>' \
             '<span>Amount sponsored: {currency} {amount_sponsored}<span></p>'\
             .format(**data)

{"golden_diff": "diff --git a/django_project/changes/feeds/sponsor.py b/django_project/changes/feeds/sponsor.py\n--- a/django_project/changes/feeds/sponsor.py\n+++ b/django_project/changes/feeds/sponsor.py\n@@ -3,8 +3,9 @@\n __author__ = 'Anita Hapsari <anita@kartoza.com>'\n __date__ = '23/10/2017'\n \n-from django.conf import settings\n+import datetime\n from django.contrib.syndication.views import Feed\n+from django.core.urlresolvers import reverse\n from django.utils.feedgenerator import Atom1Feed\n from django.shortcuts import get_object_or_404\n from base.models.project import Project\n@@ -34,6 +35,7 @@\n         :raises: Http404\n         \"\"\"\n         project_slug = kwargs.get('project_slug', None)\n+        self.domain_path_url = request.build_absolute_uri(reverse('home'))\n         return get_object_or_404(Project, slug=project_slug)\n \n     def title(self, obj):\n@@ -78,8 +80,10 @@\n         :returns: List of latest sponsor of a project\n         :rtype: list\n         \"\"\"\n+        today = datetime.datetime.now().date()\n         return SponsorshipPeriod.objects.filter(\n-            project=obj).order_by('-sponsorship_level__value', '-end_date')\n+            project=obj, end_date__gte=today\n+        ).order_by('-sponsorship_level__value', '-end_date')\n \n     def item_title(self, item):\n         \"\"\"Return the title of the sponsor.\n@@ -101,20 +105,26 @@\n         :returns: description of the sponsor\n         :rtype: str\n         \"\"\"\n+        level_class = str(item.sponsorship_level.name).decode('utf-8').lower()\n+        head, sep, tail = self.domain_path_url.partition('/en/')\n+\n         data = {\n-            'media_url': settings.MEDIA_URL,\n-            'sponsor_logo': item.sponsor.logo,\n+            'domain': head,\n+            'sponsor_logo': item.sponsor.logo.url,\n             'sponsor_level': item.sponsorship_level,\n             'start_date': item.start_date.strftime('%d %B %Y'),\n             'end_date': item.end_date.strftime('%d %B %Y'),\n             'currency': item.currency,\n             'amount_sponsored': item.amount_sponsored,\n+            'sponsor_class': level_class,\n         }\n \n         descriptions = \\\n             '<div>' \\\n-            '<img src=\"{media_url}{sponsor_logo}\" width=\"300px\"></div>' \\\n-            '<p><span>Sponsorship level: {sponsor_level}</span><br/>' \\\n+            '<img class=\"sponsor_img {sponsor_class}\" ' \\\n+            'src=\"{domain}{sponsor_logo}\" width=\"300px\"></div>' \\\n+            '<p class=\"sponsor_body {sponsor_class}\">' \\\n+            '<span>Sponsorship level: {sponsor_level}</span><br/>' \\\n             '<span>Sponsorship period: {start_date} - {end_date}</span><br/>' \\\n             '<span>Amount sponsored: {currency} {amount_sponsored}<span></p>'\\\n             .format(**data)\n", "issue": "Reshape html summary in atom/rss sponsors feed\nCurrently the sponsor items are looking like this:\r\n\r\n```\r\n<div>\r\n<img\r\nsrc=\"/media/images/projects/b9c08a00a74cba8e406e97f94a1f90595f5ac39d.png\"\r\nwidth=\"300px\">\r\n</div>\r\n<p><span>Sponsorship level: Gold : 9000 EUR</span>\r\n<br/>\r\n<span>Sponsorship period: 21 June 2017 - 21 June 2018</span><br/>\r\n<span>Amount sponsored: EUR 9000.00<span>\r\n</p>\r\n```\r\n\r\nIs it (easy) possible in this html to change the following:\r\n- make the img-element a full url (as I use the feed in qgis.org and it is easiest to just retrieve the images from changelog.qgis.org\r\n- add some classes to the img-element and the p-element as then I can do some more styling.\r\n\r\nAn example:\r\n\r\n```\r\n<div>\r\n<img src=\"http://changelog.qgis.org/media/images/projects/..5ac39d.png\"\r\nclass=\"sponsor_img gold\">\r\n</div>\r\n<p class=\"sponsor_body gold\">\r\n<span>Sponsorship level: Gold : 9000 EUR</span>\r\n<br/>\r\n<span>Sponsorship period: 21 June 2017 - 21 June 2018</span>\r\n<br/>\r\n<span>Amount sponsored: EUR 9000.00<span>\r\n</p>\r\n```\r\n\r\n\n", "before_files": [{"content": "# coding=utf-8\n\n__author__ = 'Anita Hapsari <anita@kartoza.com>'\n__date__ = '23/10/2017'\n\nfrom django.conf import settings\nfrom django.contrib.syndication.views import Feed\nfrom django.utils.feedgenerator import Atom1Feed\nfrom django.shortcuts import get_object_or_404\nfrom base.models.project import Project\nfrom changes.models.sponsorship_period import SponsorshipPeriod\nfrom changes.feeds.json_rss_feed import JSONFeed\n\n\n# noinspection PyMethodMayBeStatic\nclass RssSponsorFeed(Feed):\n    \"\"\"RSS Feed class for sponsor.\"\"\"\n\n    def get_object(self, request, *args, **kwargs):\n        \"\"\"Return project object that matches the project_slug.\n\n        :param request: The incoming HTTP request object\n        :type request: HttpRequest\n\n        :param args: Positional arguments\n        :type args: tuple\n\n        :param kwargs: Keyword arguments\n        :type kwargs: dict\n\n        :returns: A project\n        :rtype: Project\n\n        :raises: Http404\n        \"\"\"\n        project_slug = kwargs.get('project_slug', None)\n        return get_object_or_404(Project, slug=project_slug)\n\n    def title(self, obj):\n        \"\"\"Return a title for the RSS.\n\n         :param obj: A project\n         :type obj: Project\n\n         :returns: Title of the RSS Feed.\n         :rtype: str\n         \"\"\"\n        return 'RSS Sponsor of %s Project' % obj.name\n\n    def description(self, obj):\n        \"\"\"Return a description for the RSS.\n\n         :param obj: A project\n         :type obj: Project\n\n         :returns: Description of the RSS Feed.\n         :rtype: str\n         \"\"\"\n        return 'These are the latest sponsor of %s project.' % obj.name\n\n    def link(self, obj):\n        \"\"\"Return the url of the latest sponsor.\n\n        :param obj: Latest sponsor of a project\n        :type obj: SponsorshipPeriod\n\n        :returns: Url of the latest sponsor.\n        :rtype: str\n        \"\"\"\n        return obj.get_absolute_url()\n\n    def items(self, obj):\n        \"\"\"Return latest sponsors of the project.\n\n        :param obj: A project\n        :type obj: Project\n\n        :returns: List of latest sponsor of a project\n        :rtype: list\n        \"\"\"\n        return SponsorshipPeriod.objects.filter(\n            project=obj).order_by('-sponsorship_level__value', '-end_date')\n\n    def item_title(self, item):\n        \"\"\"Return the title of the sponsor.\n\n        :param item: Sponsorship period object of a project\n        :type item: Sponsorship period\n\n        :returns: name of the sponsor\n        :rtype: str\n        \"\"\"\n        return item.sponsor.name\n\n    def item_description(self, item):\n        \"\"\"Return the description of the sponsor.\n\n        :param item: Sponsorship period object of a project\n        :type item: Sponsorship period\n\n        :returns: description of the sponsor\n        :rtype: str\n        \"\"\"\n        data = {\n            'media_url': settings.MEDIA_URL,\n            'sponsor_logo': item.sponsor.logo,\n            'sponsor_level': item.sponsorship_level,\n            'start_date': item.start_date.strftime('%d %B %Y'),\n            'end_date': item.end_date.strftime('%d %B %Y'),\n            'currency': item.currency,\n            'amount_sponsored': item.amount_sponsored,\n        }\n\n        descriptions = \\\n            '<div>' \\\n            '<img src=\"{media_url}{sponsor_logo}\" width=\"300px\"></div>' \\\n            '<p><span>Sponsorship level: {sponsor_level}</span><br/>' \\\n            '<span>Sponsorship period: {start_date} - {end_date}</span><br/>' \\\n            '<span>Amount sponsored: {currency} {amount_sponsored}<span></p>'\\\n            .format(**data)\n        return descriptions\n\n    def item_extra_kwargs(self, item):\n        return {'image_url': item.sponsor.logo.url}\n\n\n\nclass AtomSponsorFeed(RssSponsorFeed):\n    \"\"\"Atom Feed class for sponsor.\"\"\"\n\n    feed_type = Atom1Feed\n    subtitle = RssSponsorFeed.description\n\n\nclass JSONSponsorFeed(RssSponsorFeed):\n    \"\"\"JSON Feed class for sponsor.\"\"\"\n\n    feed_type = JSONFeed\n", "path": "django_project/changes/feeds/sponsor.py"}], "after_files": [{"content": "# coding=utf-8\n\n__author__ = 'Anita Hapsari <anita@kartoza.com>'\n__date__ = '23/10/2017'\n\nimport datetime\nfrom django.contrib.syndication.views import Feed\nfrom django.core.urlresolvers import reverse\nfrom django.utils.feedgenerator import Atom1Feed\nfrom django.shortcuts import get_object_or_404\nfrom base.models.project import Project\nfrom changes.models.sponsorship_period import SponsorshipPeriod\nfrom changes.feeds.json_rss_feed import JSONFeed\n\n\n# noinspection PyMethodMayBeStatic\nclass RssSponsorFeed(Feed):\n    \"\"\"RSS Feed class for sponsor.\"\"\"\n\n    def get_object(self, request, *args, **kwargs):\n        \"\"\"Return project object that matches the project_slug.\n\n        :param request: The incoming HTTP request object\n        :type request: HttpRequest\n\n        :param args: Positional arguments\n        :type args: tuple\n\n        :param kwargs: Keyword arguments\n        :type kwargs: dict\n\n        :returns: A project\n        :rtype: Project\n\n        :raises: Http404\n        \"\"\"\n        project_slug = kwargs.get('project_slug', None)\n        self.domain_path_url = request.build_absolute_uri(reverse('home'))\n        return get_object_or_404(Project, slug=project_slug)\n\n    def title(self, obj):\n        \"\"\"Return a title for the RSS.\n\n         :param obj: A project\n         :type obj: Project\n\n         :returns: Title of the RSS Feed.\n         :rtype: str\n         \"\"\"\n        return 'RSS Sponsor of %s Project' % obj.name\n\n    def description(self, obj):\n        \"\"\"Return a description for the RSS.\n\n         :param obj: A project\n         :type obj: Project\n\n         :returns: Description of the RSS Feed.\n         :rtype: str\n         \"\"\"\n        return 'These are the latest sponsor of %s project.' % obj.name\n\n    def link(self, obj):\n        \"\"\"Return the url of the latest sponsor.\n\n        :param obj: Latest sponsor of a project\n        :type obj: SponsorshipPeriod\n\n        :returns: Url of the latest sponsor.\n        :rtype: str\n        \"\"\"\n        return obj.get_absolute_url()\n\n    def items(self, obj):\n        \"\"\"Return latest sponsors of the project.\n\n        :param obj: A project\n        :type obj: Project\n\n        :returns: List of latest sponsor of a project\n        :rtype: list\n        \"\"\"\n        today = datetime.datetime.now().date()\n        return SponsorshipPeriod.objects.filter(\n            project=obj, end_date__gte=today\n        ).order_by('-sponsorship_level__value', '-end_date')\n\n    def item_title(self, item):\n        \"\"\"Return the title of the sponsor.\n\n        :param item: Sponsorship period object of a project\n        :type item: Sponsorship period\n\n        :returns: name of the sponsor\n        :rtype: str\n        \"\"\"\n        return item.sponsor.name\n\n    def item_description(self, item):\n        \"\"\"Return the description of the sponsor.\n\n        :param item: Sponsorship period object of a project\n        :type item: Sponsorship period\n\n        :returns: description of the sponsor\n        :rtype: str\n        \"\"\"\n        level_class = str(item.sponsorship_level.name).decode('utf-8').lower()\n        head, sep, tail = self.domain_path_url.partition('/en/')\n\n        data = {\n            'domain': head,\n            'sponsor_logo': item.sponsor.logo.url,\n            'sponsor_level': item.sponsorship_level,\n            'start_date': item.start_date.strftime('%d %B %Y'),\n            'end_date': item.end_date.strftime('%d %B %Y'),\n            'currency': item.currency,\n            'amount_sponsored': item.amount_sponsored,\n            'sponsor_class': level_class,\n        }\n\n        descriptions = \\\n            '<div>' \\\n            '<img class=\"sponsor_img {sponsor_class}\" ' \\\n            'src=\"{domain}{sponsor_logo}\" width=\"300px\"></div>' \\\n            '<p class=\"sponsor_body {sponsor_class}\">' \\\n            '<span>Sponsorship level: {sponsor_level}</span><br/>' \\\n            '<span>Sponsorship period: {start_date} - {end_date}</span><br/>' \\\n            '<span>Amount sponsored: {currency} {amount_sponsored}<span></p>'\\\n            .format(**data)\n        return descriptions\n\n    def item_extra_kwargs(self, item):\n        return {'image_url': item.sponsor.logo.url}\n\n\n\nclass AtomSponsorFeed(RssSponsorFeed):\n    \"\"\"Atom Feed class for sponsor.\"\"\"\n\n    feed_type = Atom1Feed\n    subtitle = RssSponsorFeed.description\n\n\nclass JSONSponsorFeed(RssSponsorFeed):\n    \"\"\"JSON Feed class for sponsor.\"\"\"\n\n    feed_type = JSONFeed\n", "path": "django_project/changes/feeds/sponsor.py"}]}