diff options
Diffstat (limited to 'chimere/models.py')
| -rw-r--r-- | chimere/models.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/chimere/models.py b/chimere/models.py index c1b47d3..d00d0b6 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -2057,19 +2057,28 @@ class Area(models.Model, SimpleArea): """ Get the sql statement for the test if the point is included in the area """ - return Q(point__contained=self.getWkt()) + q = Q(point__contained=self.getWkt()) + if self.subcategories.count(): + q = q & Q(categories__in=self.subcategories.all()) + return q def getIncludeRoute(self): """ Get the sql statement for the test if the route is included in the area """ - return Q(route__contained=self.getWkt()) + q = Q(route__contained=self.getWkt()) + if self.subcategories.count(): + q = q & Q(categories__in=self.subcategories.all()) + return q def getIncludePolygon(self): """ Get the sql statement for the test if the route is included in the area """ - return Q(polygon__contained=self.getWkt()) + q = Q(polygon__contained=self.getWkt()) + if self.subcategories.count(): + q = q & Q(categories__in=self.subcategories.all()) + return q pre_save_area_values = {} |
