web/views/formrenderers.py
changeset 2819 b864288fd316
parent 2656 a93ae0f6c0ad
child 2890 fdcb8a2bb6eb
--- a/web/views/formrenderers.py	Thu Aug 13 11:32:34 2009 +0200
+++ b/web/views/formrenderers.py	Thu Aug 13 11:49:56 2009 +0200
@@ -15,11 +15,16 @@
 from cubicweb.common import tags
 from cubicweb.appobject import AppObject
 from cubicweb.selectors import entity_implements, yes
-from cubicweb.web import eid_param
-from cubicweb.web import formwidgets as fwdgs
-from cubicweb.web.widgets import checkbox
+from cubicweb.web import eid_param, formwidgets as fwdgs
 from cubicweb.web.formfields import HiddenInitialValueField
 
+def checkbox(name, value, attrs='', checked=None):
+    if checked is None:
+        checked = value
+    checked = checked and 'checked="checked"' or ''
+    return u'<input type="checkbox" name="%s" value="%s" %s %s />' % (
+        name, value, checked, attrs)
+
 
 class FormRenderer(AppObject):
     """basic renderer displaying fields in a two columns table label | value