From ccface07480114a5e8284ece2101950b5b95da94 Mon Sep 17 00:00:00 2001 From: Sanj Date: Wed, 23 May 2012 15:33:44 +0530 Subject: [PATCH] use GeoManager on models to allow spatial queries --- chaloBEST/mumbai/models.py | 3 ++- chaloBEST/templates/area.html | 28 ++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/chaloBEST/mumbai/models.py b/chaloBEST/mumbai/models.py index 4ab7929..06dbc70 100644 --- a/chaloBEST/mumbai/models.py +++ b/chaloBEST/mumbai/models.py @@ -53,7 +53,7 @@ RUNTIMES = ( (20, 24) ) -class TrigramSearchManager(models.Manager): +class TrigramSearchManager(models.GeoManager): def __init__(self, trigram_columns=[]): super(TrigramSearchManager, self).__init__() self.trigram_columns = trigram_columns @@ -228,6 +228,7 @@ class Route(models.Model): to_stop = models.ForeignKey(Stop, related_name='routes_to', default=None, null=True, blank=True) distance = models.DecimalField(max_digits=3, decimal_places=1) stages = models.IntegerField() + class Meta: ordering = ['code'] diff --git a/chaloBEST/templates/area.html b/chaloBEST/templates/area.html index c4a097d..d80afce 100644 --- a/chaloBEST/templates/area.html +++ b/chaloBEST/templates/area.html @@ -20,14 +20,26 @@ a:hover { {% endblock %} {% block body %} - + +
{% endblock %}