add routes list to stop GET

This commit is contained in:
Sanj 2012-02-19 19:02:27 +05:30
parent de01b12eed
commit e92fc98ab1

View File

@ -97,6 +97,7 @@ class Stop(models.Model):
alt_names = generic.GenericRelation("AlternativeName") alt_names = generic.GenericRelation("AlternativeName")
def get_dict(self): def get_dict(self):
routes = [r.route.alias for r in RouteDetail.objects.filter(stop=self)]
return { return {
'id': self.id, 'id': self.id,
'code': self.code, 'code': self.code,
@ -105,7 +106,8 @@ class Stop(models.Model):
'display_name': self.display_name, 'display_name': self.display_name,
'road': self.road.name, 'road': self.road.name,
'area': self.area.name, 'area': self.area.name,
'name_mr': self.name_mr 'name_mr': self.name_mr,
'routes': routes
#FIXME: add alt names #FIXME: add alt names
} }