web/views/editforms.py
branchstable
changeset 2328 206735882b8e
parent 2327 2aa28ac13d64
child 2329 8b5a1af6dc35
--- a/web/views/editforms.py	Wed Jul 08 17:22:24 2009 +0200
+++ b/web/views/editforms.py	Wed Jul 08 17:24:21 2009 +0200
@@ -22,8 +22,8 @@
 from cubicweb.common import tags
 from cubicweb.web import INTERNAL_FIELD_VALUE, stdmsgs, eid_param
 from cubicweb.web.form import FormViewMixIn
-from cubicweb.web.formfields import RelationField
-from cubicweb.web.formwidgets import Button, SubmitButton, ResetButton, Select
+from cubicweb.web.formfields import guess_field
+from cubicweb.web.formwidgets import Button, SubmitButton, ResetButton
 from cubicweb.web.views import forms
 
 
@@ -148,9 +148,8 @@
                                        form_buttons=[SubmitButton(),
                                                      Button(stdmsgs.BUTTON_CANCEL,
                                                        onclick=cancelclick)])
-        form.append_field(RelationField(name=rtype, role=role, sort=True,
-                                        widget=Select(),
-                                        label=u' '))
+        field = guess_field(entity.e_schema, entity.schema.rschema(rtype), role)
+        form.append_field(field)
         self.w(tags.div(value, klass='editableField', id=divid,
                         ondblclick=self.ondblclick % event_data))
         return form