web/views/autoform.py
changeset 4083 3b285889b8e9
parent 4082 c7117119e215
child 4105 de31c3afe975
--- a/web/views/autoform.py	Wed Dec 09 15:19:48 2009 +0100
+++ b/web/views/autoform.py	Wed Dec 09 15:47:01 2009 +0100
@@ -274,10 +274,7 @@
             ttype = ttypes[0].type
             if self.should_inline_relation_form(rschema, ttype, role):
                 formviews = list(self.inline_edition_form_view(rschema, ttype, role))
-                if role == 'subject':
-                    card = rschema.rproperty(entity.e_schema, ttype, 'cardinality')[0]
-                else:
-                    card = rschema.rproperty(ttype, entity.e_schema, 'cardinality')[1]
+                card = rschema.rdef(entity.e_schema, ttype).role_cardinality(role)
                 # there is no related entity and we need at least one: we need to
                 # display one explicit inline-creation view
                 if self.should_display_inline_creation_form(rschema, formviews, card):
@@ -285,7 +282,7 @@
                 # we can create more than one related entity, we thus display a link
                 # to add new related entities
                 if self.should_display_add_new_relation_link(rschema, formviews, card):
-                    addnewlink = self.vreg['views'].select(
+                    addnewlink = self._cw.vreg['views'].select(
                         'inline-addnew-link', self._cw,
                         etype=ttype, rtype=rschema, role=role,
                         peid=self.edited_entity.eid, pform=self, card=card)