add page for areas listing
This commit is contained in:
parent
5e775f097c
commit
53669913e9
|
@ -49,6 +49,8 @@ class Area(models.Model):
|
|||
geometry = models.PolygonField(blank=True, null=True)
|
||||
alt_names = generic.GenericRelation("AlternativeName")
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "/area/%s/" % self.name
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
|
|
@ -20,3 +20,19 @@ def route(request, alias):
|
|||
'routeDetails': routeDetails
|
||||
})
|
||||
return render_to_response("route.html", context)
|
||||
|
||||
def areas(request):
|
||||
context = RequestContext(request, {
|
||||
'areas': Area.objects.all()
|
||||
})
|
||||
return render_to_response("areas.html", context)
|
||||
|
||||
def area(request, name):
|
||||
area = get_object_or_404(Area, name=name)
|
||||
stops = Stop.objects.filter(area=area)
|
||||
context = RequestContext(request, {
|
||||
'area': area,
|
||||
'stops': stops
|
||||
})
|
||||
return render_to_response("area.html", context)
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ urlpatterns = patterns('',
|
|||
url(r'^static/(?P<path>.*)$','django.views.static.serve', {'document_root':'./static'}),
|
||||
(r'^routes/$', 'mumbai.views.routes'),
|
||||
(r'^route/(?P<alias>[a-zA-Z0-9\s\-]*?)/$', 'mumbai.views.route'),
|
||||
(r'^areas/$', 'mumbai.views.areas'),
|
||||
(r'^area/(?P<name>.*?)/$', 'mumbai.views.area'),
|
||||
|
||||
# Uncomment the admin/doc line below to enable admin documentation:
|
||||
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
#(r'^grappelli/', include('grappelli.urls')),
|
||||
|
|
Loading…
Reference in New Issue
Block a user