oops, forgot to add feeds.py
This commit is contained in:
parent
4bd46313fa
commit
c6894cccef
41
chaloBEST/feeds.py
Normal file
41
chaloBEST/feeds.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
#from django.contrib.syndication.views import Feed
|
||||
#from django.contrib.gis.feeds import Feed
|
||||
from django.contrib.gis.feeds import Feed
|
||||
from mumbai.models import *
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
|
||||
|
||||
|
||||
class RouteFeed(Feed):
|
||||
# description_template = 'feeds/route_description.html'
|
||||
|
||||
def get_object(self, request, alias):
|
||||
return get_object_or_404(Route, alias=alias)
|
||||
|
||||
def title(self, obj):
|
||||
return "ChaloBEST.in: Feed for Bus No.: %s" % obj.alias
|
||||
|
||||
def description(self, obj):
|
||||
return "GeoRSS Route Feed"
|
||||
|
||||
def geometry(self, obj):
|
||||
return obj.from_stop.point
|
||||
|
||||
def link(self, obj):
|
||||
return obj.get_absolute_url()
|
||||
|
||||
def items(self, obj):
|
||||
return Stop.objects.filter(routedetail__route=obj)
|
||||
|
||||
def item_title(self, obj):
|
||||
return obj.display_name
|
||||
|
||||
def item_geometry(self, obj):
|
||||
return obj.point
|
||||
|
||||
def item_link(self, obj):
|
||||
return obj.get_absolute_url()
|
||||
|
||||
def item_description(self, obj):
|
||||
return obj.display_name #FIXME
|
Loading…
Reference in New Issue
Block a user