web/formfields.py
branchstable
changeset 6285 b8a2c9b9a2cb
parent 6218 d37428222a63
child 6333 e3994fcc21c3
--- a/web/formfields.py	Fri Sep 17 17:25:17 2010 +0200
+++ b/web/formfields.py	Fri Sep 17 17:25:51 2010 +0200
@@ -871,6 +871,15 @@
         # XXX empty string for 'no' in that case for bw compat
         return [(form._cw._('yes'), '1'), (form._cw._('no'), '')]
 
+    def format_single_value(self, req, value):
+        """return value suitable for display"""
+        if self.allow_none:
+            if value is None:
+                return u''
+            if value is False:
+                return '0'
+        return super(BooleanField, self).format_single_value(req, value)
+
     def _ensure_correctly_typed(self, form, value):
         if self.allow_none:
             if value: