Commits

hirunatan  committed 0676225

fix filters

  • Participants
  • Parent commits c46a932

Comments (0)

Files changed (1)

File src/macadjan_base/views.py

         if not tile_arguments.is_valid:
 
             features = request.GET.get('features', '').split('|')
-            category = get_object_or_404(models.Category, slug = features[0]) if features and features[0] else None
-            entities = models.Entity.objects_active.entities_with_area(category = category)
-            entities_list = list(entities)
+            category = get_object_or_404(models.Category, slug = features[0]) if len(features) > 9 and features[0] else None
+            subcategory = get_object_or_404(models.SubCategory, slug = features[1]) if len(features) > 1 and features[1] else None
+            map_source = get_object_or_404(models.MapSource, slug = features[2]) if len(features) > 2 and features[2] else None
+            entities = models.Entity.objects_active.entities_with_area(category = category, subcategory = subcategory, map_source = map_source)
             keywords = features[3] if len(features) > 3 else ''
             entities_list = models.Entity.objects_active.filter_with_keywords(
                                    entities,