web/views/autoform.py
branchstable
changeset 4579 19d73051eb57
parent 4570 ede247bbbf62
child 4585 912aba7e6400
--- a/web/views/autoform.py	Mon Feb 15 15:14:50 2010 +0100
+++ b/web/views/autoform.py	Mon Feb 15 15:16:08 2010 +0100
@@ -384,7 +384,11 @@
             related = []
             if entity.has_eid():
                 rset = entity.related(rschema, role, limit=form.related_limit)
-                if rschema.has_perm(form._cw, 'delete'):
+                if role == 'subject':
+                    haspermkwargs = {'fromeid': entity.eid}
+                else:
+                    haspermkwargs = {'toeid': entity.eid}
+                if rschema.has_perm(form._cw, 'delete', **haspermkwargs):
                     toggleable_rel_link_func = toggleable_relation_link
                 else:
                     toggleable_rel_link_func = lambda x, y, z: u''