--- a/src/spel/views.py Fri Mar 07 13:06:24 2014 +0100
+++ b/src/spel/views.py Fri Mar 07 14:54:45 2014 +0100
@@ -31,6 +31,12 @@
template_name = "partial/spel_chapters.html"
def get(self, request):
+ # Filter segment if necessary
+ annot_types_param = request.GET.get("annotation_types", "")
+ seg_queryset = Segment
+ if annot_types_param!="":
+ annot_types = annot_types_param.split(",")
+ seg_queryset = Segment.objects.filter(cutting_id__in=annot_types)
# First we look at modalites_sceniques and personnages tags.
mod_scen_param = request.GET.get("modalites_sceniques", "")
@@ -46,8 +52,7 @@
all_tags = mod_scen + perso
tags = Tag.objects.filter(name__in=all_tags)
# Get segments from tagged items
- #TaggedItem.objects.get_by_model(segment_queryset, tags)
- s = TaggedItem.objects.get_by_model(Segment, tags)
+ s = TaggedItem.objects.get_by_model(seg_queryset, tags)
logger.debug("COUCOU")
@@ -58,9 +63,7 @@
#logger.debug(tags)
#logger.debug(s)
- #request.GET.get("annotation_types", "")
-
- context = {"segments": s, "annotation_types": [], "tags": mod_scen+perso }
+ context = {"segments": s }
return self.render_to_response(context)