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
|
||||||
|
@ -229,6 +229,7 @@ class Route(models.Model):
|
||||||
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 %}
|
||||||
|
<div id="stopListWrapper" class="listColumn">
|
||||||
<ul id="stopList">
|
<ul id="stopList">
|
||||||
{% for s in stops %}
|
{% for stop in stops %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ s.get_absolute_url }}" class="{% if s.point %} has_point {% else %} no_point {% endif %}">{{ s.name }}</a>
|
<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>
|
</li>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="map"></div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user