use GeoManager on models to allow spatial queries
This commit is contained in:
parent
53037c064f
commit
ccface0748
|
@ -53,7 +53,7 @@ RUNTIMES = (
|
||||||
(20, 24)
|
(20, 24)
|
||||||
)
|
)
|
||||||
|
|
||||||
class TrigramSearchManager(models.Manager):
|
class TrigramSearchManager(models.GeoManager):
|
||||||
def __init__(self, trigram_columns=[]):
|
def __init__(self, trigram_columns=[]):
|
||||||
super(TrigramSearchManager, self).__init__()
|
super(TrigramSearchManager, self).__init__()
|
||||||
self.trigram_columns = trigram_columns
|
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)
|
to_stop = models.ForeignKey(Stop, related_name='routes_to', default=None, null=True, blank=True)
|
||||||
distance = models.DecimalField(max_digits=3, decimal_places=1)
|
distance = models.DecimalField(max_digits=3, decimal_places=1)
|
||||||
stages = models.IntegerField()
|
stages = models.IntegerField()
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['code']
|
ordering = ['code']
|
||||||
|
|
|
@ -20,14 +20,26 @@ a:hover {
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<ul id="stopList">
|
<div id="stopListWrapper" class="listColumn">
|
||||||
{% for s in stops %}
|
<ul id="stopList">
|
||||||
<li>
|
{% for stop in stops %}
|
||||||
<a href="{{ s.get_absolute_url }}" class="{% if s.point %} has_point {% else %} no_point {% endif %}">{{ s.name }}</a>
|
<li>
|
||||||
</li>
|
<a href="{{ stop.get_absolute_url }}">{{ s.name }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="routeListWrapper" class="listColumn">
|
||||||
|
<input class="listFilterInput" placeholder="Filter..." />
|
||||||
|
<ul id="routeList">
|
||||||
|
{% for route in routes %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ route.get_absolute_url }}">{{ route.alias }}</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
</ul>
|
</div>
|
||||||
|
<div id="map"></div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user