fix area page

This commit is contained in:
Sanj 2012-05-23 17:02:54 +05:30
parent b63b263a8a
commit bc88a5ffe1
2 changed files with 6 additions and 2 deletions

View File

@ -115,6 +115,10 @@ class Area(models.Model):
area_ids = [val['area'] for val in qset] area_ids = [val['area'] for val in qset]
return Area.objects.filter(pk__in=area_ids) return Area.objects.filter(pk__in=area_ids)
@property
def routes_passing(self):
return Route.objects.filter(routedetail__stop__area=self).distinct()
class Road(models.Model): class Road(models.Model):
code = models.IntegerField()#primary_key=True) code = models.IntegerField()#primary_key=True)
slug = models.SlugField(null=True) slug = models.SlugField(null=True)

View File

@ -26,7 +26,7 @@ a:hover {
<ul id="stopList"> <ul id="stopList">
{% for stop in stops %} {% for stop in stops %}
<li> <li>
<a href="{{ stop.get_absolute_url }}">{{ s.display_name }}</a> <a href="{{ stop.get_absolute_url }}">{{ stop.display_name }}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -35,7 +35,7 @@ a:hover {
<h4>Routes passing through {{ area.display_name }}:</h4> <h4>Routes passing through {{ area.display_name }}:</h4>
<input class="listFilterInput" placeholder="Filter..." /> <input class="listFilterInput" placeholder="Filter..." />
<ul id="routeList"> <ul id="routeList">
{% for route in routes %} {% for route in area.routes_passing %}
<li> <li>
<a href="{{ route.get_absolute_url }}">{{ route.alias }}</a> <a href="{{ route.get_absolute_url }}">{{ route.alias }}</a>
</li> </li>