Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix issues with feeds discovered on production server

  • Loading branch information...
commit 5dc1b5f6c2de499619a3c3662d2a69997b581ec1 1 parent a3b7509
@visiblegovernment authored
View
18 mainapp/feeds.py
@@ -3,8 +3,20 @@
from mainapp.models import Report, ReportUpdate, City, Ward
from django.shortcuts import get_object_or_404
+class ReportFeedBase(Feed):
+ description_template = 'feeds/reports_description.html'
-class LatestReports(Feed):
+ def item_title(self, item):
+ return item.title
+
+ def item_pubdate(self, item):
+ return item.created_at
+
+ def item_link(self,item):
+ return item.get_absolute_url()
+
+
+class LatestReports(ReportFeedBase):
title = "All FixMyStreet Reports"
link = "/reports/"
description = "All FixMyStreet.ca Reports"
@@ -12,7 +24,7 @@ class LatestReports(Feed):
def items(self):
return Report.objects.filter(is_confirmed=True).order_by('-created_at')[:30]
-class CityFeedBase(Feed):
+class CityFeedBase(ReportFeedBase):
def title(self, obj):
return "FixMyStreet.ca: Reports for %s" % obj.name
@@ -39,7 +51,7 @@ class CitySlugFeed(CityFeedBase):
def get_object(self, request, slug ):
return get_object_or_404(City, slug=slug)
-class WardFeedBase(Feed):
+class WardFeedBase(ReportFeedBase):
def title(self, obj):
return "FixMyStreet.ca: Reports for %s, %s" % (obj.name, obj.city.name)
View
2  mainapp/models.py
@@ -172,7 +172,7 @@ def feed_url(self):
def save(self):
if not self.slug:
- self.slug = slugify(self.city.name + "-" + self.name )
+ self.slug = slugify( self.name )
super(Ward,self).save()
def __unicode__(self):
View
2  templates/feeds/cities_description.html
@@ -1,2 +0,0 @@
-<p>{{obj.desc|linebreaks}}</p>
-<em>Filed on {{obj.created_at|date}}</em>
View
1  templates/feeds/cities_title.html
@@ -1 +0,0 @@
-{{obj.ward.name|safe}}: {{ obj.title|safe}}
View
2  templates/feeds/report_updates_description.html
@@ -1,2 +0,0 @@
-<p>{{obj.desc|linebreaks}}</p>
-<em>Filed on {{obj.created_at|date}}</em>
View
1  templates/feeds/report_updates_title.html
@@ -1 +0,0 @@
-{{obj.title}}
View
2  templates/feeds/reports_description.html
@@ -1,2 +1,2 @@
-<p>{{obj.desc}}</p>
+<p>{{obj.desc|linebreaks}}</p>
<em>Filed at {{obj.created_at}} in {{obj.ward.name}},{{obj.ward.city.name}}</em>
View
2  templates/feeds/wards_description.html
@@ -1,2 +0,0 @@
-<p>{{obj.desc|linebreaks}}</p>
-<em>Filed on {{obj.created_at|date}}</em>
View
1  templates/feeds/wards_title.html
@@ -1 +0,0 @@
-{{ obj.title|safe }}
Please sign in to comment.
Something went wrong with that request. Please try again.