Parcourir la source

view: In the minimap, only display panoramas that are not too far away

Baptiste Jonglez il y a 8 ans
Parent
commit
71da6eeb87
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      panorama/views.py

+ 2 - 1
panorama/views.py

@@ -43,7 +43,8 @@ class PanoramaView(CelutzLoginMixin, DetailView):
 
     def get_context_data(self, **kwargs):
         context = super(PanoramaView, self).get_context_data(**kwargs)
-        context['panoramas'] = Panorama.objects.all()
+        pano = context['panorama']
+        context['panoramas'] = [p for p in Panorama.objects.all() if pano.great_circle_distance(p) <= settings.PANORAMA_MAX_DISTANCE]
         return context