summaryrefslogtreecommitdiff
path: root/chimere/main/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2010-11-18 20:11:55 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2010-11-18 20:11:55 +0100
commitfdf82c977f28d86c7d9352c11765461e6a15241c (patch)
treeb30f611843d51eea7e9289efc3cc5c7fba2c361f /chimere/main/models.py
parentfaf7d02a261f6c2eba6d9cc7e349c70641cacd8f (diff)
parent7109b55069ba31317d2d5cd68819f5d179a88380 (diff)
downloadChimère-fdf82c977f28d86c7d9352c11765461e6a15241c.tar.bz2
Chimère-fdf82c977f28d86c7d9352c11765461e6a15241c.zip
Merge branch 'v1.0'
Conflicts: chimere/main/models.py chimere/scripts/upgrade.py docs/en/UPGRADE.t2t
Diffstat (limited to 'chimere/main/models.py')
-rw-r--r--chimere/main/models.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/chimere/main/models.py b/chimere/main/models.py
index 0a037a6..564552f 100644
--- a/chimere/main/models.py
+++ b/chimere/main/models.py
@@ -362,7 +362,8 @@ class SimpleArea:
sql_main = '''select subcat.id as id, subcat.category_id as category_id,
subcat.name as name, subcat.available as available, subcat.icon_id as icon_id,
subcat.color_theme_id as color_theme_id, subcat.order as order,
-subcat.item_type as item_type from main_subcategory subcat'''
+subcat.item_type as item_type from main_subcategory subcat
+inner join main_category cat on cat.id=subcat.category_id'''
sql = sql_main + '''
inner join main_marker mark on ST_Contains(%s, mark.point)''' % area
if equal_status:
@@ -371,7 +372,7 @@ inner join main_marker mark on ST_Contains(%s, mark.point)''' % area
inner join main_marker_categories mc on mc.subcategory_id=subcat.id and
mc.marker_id=mark.id'''
if filter_available:
- sql += ' where subcat.available = TRUE'
+ sql += ' where subcat.available = TRUE and cat.available = TRUE'
subcats = set(SubCategory.objects.raw(sql))
sql = sql_main + '''
inner join main_route rt on (ST_Intersects(%s, rt.route) or
@@ -382,7 +383,7 @@ ST_Contains(%s, rt.route))''' % (area, area)
inner join main_route_categories rc on rc.subcategory_id=subcat.id and
rc.route_id=rt.id'''
if filter_available:
- sql += ' where subcat.available = TRUE'
+ sql += ' where subcat.available = TRUE and cat.available = TRUE'
subcats.union(SubCategory.objects.raw(sql))
return subcats