web/ldt/ldt_utils/views.py
changeset 100 c5514a2bfdcd
parent 99 0fb4b009c6eb
child 108 d3851972ca7e
--- a/web/ldt/ldt_utils/views.py	Tue Oct 19 15:21:07 2010 +0200
+++ b/web/ldt/ldt_utils/views.py	Wed Oct 20 11:19:38 2010 +0200
@@ -784,11 +784,12 @@
     if iri_id:
         for content in Content.objects.filter(iri_id=iri_id):
             titles.append(unicode(content.title))
-            projects = Content.objects.all()[0].project_set.all()
+            projects = content.project_set.all()
             projects_nb = len(projects)
             if projects_nb > 0:
-                project_titles = [lambda p: p.title for p in projects]
-                errors.append(ungettext("Content '%(title)s' is referenced by this project : %(project_titles)s. Please delete it beforehand.", "Content '%(title)s' is referenced by %(count)d projects: %(project_titles)s. Please delete them beforehand.", projects_nb)%{'title':content.title,'count':projects_nb, 'project_titles': ",".join(project_titles)}) 
+                project_titles = map(lambda p: unicode(p.title), projects)
+                errors.append(ungettext("Content '%(title)s' is referenced by this project : %(project_titles)s. Please delete it beforehand.", "Content '%(title)s' is referenced by %(count)d projects: %(project_titles)s. Please delete them beforehand.", projects_nb)%{'title':unicode(content.title),'count':projects_nb, 'project_titles': ",".join(project_titles)})
+ 
         
     return errors, titles