27 template_name = "spel_spectacle.html" |
27 template_name = "spel_spectacle.html" |
28 def get(self, request): |
28 def get(self, request): |
29 # Get start and end for date bounds (earliest is available only on django 1.6) |
29 # Get start and end for date bounds (earliest is available only on django 1.6) |
30 start_date = Content.objects.all().order_by("content_creation_date")[0].content_creation_date |
30 start_date = Content.objects.all().order_by("content_creation_date")[0].content_creation_date |
31 end_date = Content.objects.latest("content_creation_date").content_creation_date |
31 end_date = Content.objects.latest("content_creation_date").content_creation_date |
32 logger.debug("COUCOU") |
|
33 logger.debug(start_date) |
|
34 logger.debug(end_date) |
|
35 context = {"start_date":start_date, "end_date":end_date } |
32 context = {"start_date":start_date, "end_date":end_date } |
36 return self.render_to_response(context) |
33 return self.render_to_response(context) |
37 |
34 |
38 |
35 |
39 |
36 |
44 def get(self, request): |
41 def get(self, request): |
45 # Filter content by date if necessary |
42 # Filter content by date if necessary |
46 content_qs = Content.objects.all() |
43 content_qs = Content.objects.all() |
47 start_date_param = request.GET.get("start_date", "") |
44 start_date_param = request.GET.get("start_date", "") |
48 if start_date_param!="": |
45 if start_date_param!="": |
49 # |
|
50 content_qs = content_qs.filter(content_creation_date__gt=start_date_param) |
46 content_qs = content_qs.filter(content_creation_date__gt=start_date_param) |
51 end_date_param = request.GET.get("end_date", "") |
47 end_date_param = request.GET.get("end_date", "") |
52 if end_date_param!="": |
48 if end_date_param!="": |
53 content_qs = content_qs.filter(content_creation_date__lt=end_date_param + " 23:59:59") |
49 content_qs = content_qs.filter(content_creation_date__lt=end_date_param + " 23:59:59") |
54 iri_ids = content_qs.values_list("iri_id", flat=True) |
50 iri_ids = content_qs.values_list("iri_id", flat=True) |
55 logger.debug("iri_ids") |
51 #logger.debug("iri_ids") |
56 logger.debug(iri_ids) |
52 #logger.debug(iri_ids) |
57 # Filter segment if necessary |
53 # Filter segment if necessary |
58 annot_types_param = request.GET.get("annotation_types", "") |
54 annot_types_param = request.GET.get("annotation_types", "") |
59 seg_queryset = Segment.objects.filter(iri_id__in=iri_ids) |
55 seg_queryset = Segment.objects.filter(iri_id__in=iri_ids) |
60 if annot_types_param!="": |
56 if annot_types_param!="": |
61 annot_types = annot_types_param.split(",") |
57 annot_types = annot_types_param.split(",") |
62 seg_queryset = Segment.objects.filter(cutting_id__in=annot_types) |
58 seg_queryset = seg_queryset.filter(cutting_id__in=annot_types) |
63 |
59 |
64 # First we look at modalites_sceniques and personnages tags. |
60 # First we look at modalites_sceniques and personnages tags. |
65 mod_scen_param = request.GET.get("modalites_sceniques", "") |
61 mod_scen_param = request.GET.get("modalites_sceniques", "") |
66 mod_scen = [] |
62 mod_scen = [] |
67 if mod_scen_param!="": |
63 if mod_scen_param!="": |
75 all_tags = mod_scen + perso |
71 all_tags = mod_scen + perso |
76 tags = Tag.objects.filter(name__in=all_tags) |
72 tags = Tag.objects.filter(name__in=all_tags) |
77 # Get segments from tagged items |
73 # Get segments from tagged items |
78 s = TaggedItem.objects.get_by_model(seg_queryset, tags) |
74 s = TaggedItem.objects.get_by_model(seg_queryset, tags) |
79 |
75 |
80 logger.debug("COUCOU") |
76 #logger.debug("COUCOU") |
81 #logger.debug(mod_scen_param) |
77 #logger.debug(mod_scen_param) |
82 #logger.debug(perso_param) |
78 #logger.debug(perso_param) |
83 #logger.debug(mod_scen) |
79 #logger.debug(mod_scen) |
84 #logger.debug(perso) |
80 #logger.debug(perso) |
85 #logger.debug(tags) |
81 #logger.debug(tags) |