Repository: GeotrekCE/Geotrek-admin

Issue:
SensitiveAreas details page does not show nearby Sites/Courses (and the other way around)
To reproduce : create a sensitive area overlapping a site or course and visit the detail page of the sensitive area. The site or course does not appear in the list of nearby objects. (visit the site or course detail page, the sensitive area does not appear in the list either).

![image](https://user-images.githubusercontent.com/15977920/220605430-1605aa6e-4088-4846-9a2c-8f0b83abc78a.png)



Discussion:

Resolving patch:
diff --git a/geotrek/sensitivity/models.py b/geotrek/sensitivity/models.py
--- a/geotrek/sensitivity/models.py
+++ b/geotrek/sensitivity/models.py
@@ -228,6 +228,10 @@ def pretty_practices(self):
         return self.species.pretty_practices()
     pretty_practices_verbose_name = _("Practices")
 
+    def distance(self, to_cls):
+        """Distance to associate this site to another class"""
+        return settings.SENSITIVE_AREA_INTERSECTION_MARGIN
+
 
 if 'geotrek.core' in settings.INSTALLED_APPS:
     from geotrek.core.models import Topology
@@ -296,6 +300,41 @@ def pretty_practices(self):
                                lambda self: intersecting(tourism_models.TouristicEvent, self, 0).filter(published=True),
                                _("Published touristic events"))
 
+
+if 'geotrek.outdoor' in settings.INSTALLED_APPS:
+    from geotrek.outdoor import models as outdoor_models
+
+    outdoor_models.Site.add_property('sensitive_areas',
+                                     lambda self: intersecting(SensitiveArea, self, distance=0,
+                                                               ordering=False, field='geom_buffered'),
+                                     _("Sensitive areas"))
+    outdoor_models.Site.add_property('published_sensitive_areas',
+                                     lambda self: intersecting(SensitiveArea, self, distance=0, ordering=False,
+                                                               field='geom_buffered').filter(published=True),
+                                     _("Published sensitive areas"))
+    outdoor_models.Course.add_property('sensitive_areas',
+                                       lambda self: intersecting(SensitiveArea, self, distance=0,
+                                                                 ordering=False, field='geom_buffered'),
+                                       _("Sensitive areas"))
+    outdoor_models.Course.add_property('published_sensitive_areas',
+                                       lambda self: intersecting(SensitiveArea, self, distance=0, ordering=False,
+                                                                 field='geom_buffered').filter(published=True),
+                                       _("Published sensitive areas"))
+
+    SensitiveArea.add_property('sites',
+                               lambda self: intersecting(outdoor_models.Site, self),
+                               _("Touristic contents"))
+    SensitiveArea.add_property('published_sites',
+                               lambda self: intersecting(outdoor_models.Site, self).filter(published=True),
+                               _("Published touristic contents"))
+    SensitiveArea.add_property('courses',
+                               lambda self: intersecting(outdoor_models.Course, self),
+                               _("Touristic events"))
+    SensitiveArea.add_property('published_courses',
+                               lambda self: intersecting(outdoor_models.Course, self).filter(published=True),
+                               _("Published touristic events"))
+
+
 SensitiveArea.add_property('sensitive_areas', lambda self: intersecting(SensitiveArea, self, 0), _("Sensitive areas"))
 SensitiveArea.add_property('published_sensitive_areas',
                            lambda self: intersecting(SensitiveArea, self, 0).filter(published=True),


Test patch: