# HG changeset patch # User ymh # Date 1328182753 -3600 # Node ID d6371bde0c13b36b44c186d40f78ae4355f94c85 # Parent 5b198be85d50fa1207654e0d9ac2080ef6921c3c# Parent 10ec59f061981e71e3118c21e0f9f4455b12288c Merge with 10ec59f061981e71e3118c21e0f9f4455b12288c diff -r 5b198be85d50 -r d6371bde0c13 src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Thu Feb 02 12:36:05 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/models.py Thu Feb 02 12:39:13 2012 +0100 @@ -6,7 +6,7 @@ from ldt.core.models import Document from guardian.shortcuts import assign, remove_perm, get_perms import ldt.indexation -from ldt.security import get_current_user_or_admin, set_current_user +from ldt.security import get_current_user_or_admin, set_current_user, get_current_user from ldt.security.models import SafeModel from ldt.security.manager import SafeManager from sorl.thumbnail import ImageField @@ -234,6 +234,8 @@ # We need a primary key for self in create_project, so # save() has to be called first self.create_front_project() + assign('ldt_utils.change_content', get_current_user(), self) + def __unicode__(self): return str(self.id) + ": " + self.iri_id @@ -364,19 +366,18 @@ is_public = property(**is_public()) def create_front_project(self): - request_user = get_current_user_or_admin() + old_user = get_current_user_or_admin() - if request_user.is_superuser: - admin = request_user + if old_user.is_superuser: + admin = old_user else: admin = User.objects.filter(is_superuser=True)[0] set_current_user(admin) self.front_project = Project.create_project(admin, 'front project : %s' % self.title, [self], cuttings=['chapitrage', 'contributions'] ) self.front_project.publish(allow_write=True) - set_current_user(request_user) + set_current_user(old_user) - assign('ldt_utils.change_content', request_user, self) self.save() # Tag management diff -r 5b198be85d50 -r d6371bde0c13 src/ldt/ldt/ldt_utils/stat.py --- a/src/ldt/ldt/ldt_utils/stat.py Thu Feb 02 12:36:05 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/stat.py Thu Feb 02 12:39:13 2012 +0100 @@ -41,18 +41,16 @@ def update_stat_project(project, contents_only=[]): - if project.state != 2: - return None - if contents_only: - contents = contents_only - else: - contents = project.contents.all() + if contents_only: + contents = contents_only + else: + contents = project.contents.all() - for c in contents: - update_stat_content(c) + for c in contents: + update_stat_content(c) - return True + return True def add_annotation_to_stat(content, begin, end, polemics=[]): diff -r 5b198be85d50 -r d6371bde0c13 src/ldt/ldt/ldt_utils/templates/front/front_search_results.html --- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Thu Feb 02 12:36:05 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Thu Feb 02 12:39:13 2012 +0100 @@ -26,6 +26,10 @@ "segments" : [ {% for segment in res.list %} { "id" : '{{segment.element_id}}', + "project_id": '{{segment.project_id}}', + "ensemble_id": '{{segment.ensemble_id}}', + "cutting_id": '{{segment.cutting_id}}', + "iri_id": '{{segment.iri_id}}', "begin" : {{segment.start_ts}}, "duration" : {{segment.duration}}, },{% endfor %} @@ -85,7 +89,7 @@