web/views/autoform.py
branchtls-sprint
changeset 1743 591cff8f0701
parent 1739 78b0819162a8
child 1752 4b0b912ff5b7
--- a/web/views/autoform.py	Tue May 12 16:24:27 2009 +0200
+++ b/web/views/autoform.py	Tue May 12 16:27:23 2009 +0200
@@ -145,10 +145,12 @@
             if eschema is None or not name in cls_or_self.schema:
                 raise
             rschema = cls_or_self.schema.rschema(name)
-            fieldcls = cls_or_self.rfields.etype_get(eschema, rschema, role)
+            # XXX use a sample target type. Document this.
+            tschemas = rschema.targets(eschema, role)
+            fieldcls = cls_or_self.rfields.etype_get(eschema, rschema, role, tschemas[0])
             if fieldcls:
                 return fieldcls(name=name, role=role, eidparam=True)
-            widget = cls_or_self.rwidgets.etype_get(eschema, rschema, role)
+            widget = cls_or_self.rwidgets.etype_get(eschema, rschema, role, tschemas[0])
             if widget:
                 field = guess_field(eschema, rschema, role,
                                     eidparam=True, widget=widget)