Browse Source

Sort reference points by distance in the panorama view

Baptiste Jonglez 9 years ago
parent
commit
1713f18e0d
1 changed files with 1 additions and 0 deletions
  1. 1 0
      panorama/models.py

+ 1 - 0
panorama/models.py

@@ -184,6 +184,7 @@ class Panorama(ReferencePoint):
 
         refpoints = [refpoint for refpoint in ReferencePoint.objects.all()
                      if self.great_circle_distance(refpoint) <= settings.PANORAMA_MAX_DISTANCE and refpoint.pk != self.pk]
+        refpoints.sort(key=lambda r: self.line_distance(r))
         return enumerate([{"id": r.pk,
                            "name": r.name,
                            "url": get_url(r),