diff --git a/lostplaces/lostplaces_app/models.py b/lostplaces/lostplaces_app/models.py index d51f12e..0e28056 100644 --- a/lostplaces/lostplaces_app/models.py +++ b/lostplaces/lostplaces_app/models.py @@ -92,6 +92,10 @@ class Place (models.Model): tags = TaggableManager(blank=True) + def get_absolute_url(self): + return reverse('place_detail', kwargs={'pk': self.pk}) + + @classmethod # Get center position of LP-geocoordinates. def average_latlon(cls, place_list): diff --git a/lostplaces/lostplaces_app/templates/partials/osm_map.html b/lostplaces/lostplaces_app/templates/partials/osm_map.html index 5c64fcc..2433263 100644 --- a/lostplaces/lostplaces_app/templates/partials/osm_map.html +++ b/lostplaces/lostplaces_app/templates/partials/osm_map.html @@ -11,20 +11,20 @@ }), ], view: new ol.View({ - center: ol.proj.fromLonLat([{{place_map_center.longitude}}, {{place_map_center.latitude}}]), + center: ol.proj.fromLonLat([{{config.map_center.longitude}}, {{config.map_center.latitude}}]), zoom: 9 }) }); var vectorSource = new ol.source.Vector({ features: [ - {% for place in place_list %} + {% for config.point in point_list %} new ol.Feature({ geometry: new ol.geom.Point( - ol.proj.fromLonLat([{{place.longitude}},{{place.latitude}}]) + ol.proj.fromLonLat([{{point.longitude}},{{point.latitude}}]) ), - url: '{% url 'place_detail' pk=place.pk %}', - name: '{{place.name}}' + url: '{{point.get_absolute_url}}', + name: '{{point.name}}' }), {% endfor %} ]