873 |
873 |
874 def vocabulary(self, form): |
874 def vocabulary(self, form): |
875 if self.choices: |
875 if self.choices: |
876 return super(BooleanField, self).vocabulary(form) |
876 return super(BooleanField, self).vocabulary(form) |
877 if self.allow_none: |
877 if self.allow_none: |
878 return [('', ''), (form._cw._('yes'), '1'), (form._cw._('no'), '0')] |
878 return [(form._cw._('indifferent'), ''), |
|
879 (form._cw._('yes'), '1'), |
|
880 (form._cw._('no'), '0')] |
879 # XXX empty string for 'no' in that case for bw compat |
881 # XXX empty string for 'no' in that case for bw compat |
880 return [(form._cw._('yes'), '1'), (form._cw._('no'), '')] |
882 return [(form._cw._('yes'), '1'), (form._cw._('no'), '')] |
881 |
883 |
882 def format_single_value(self, req, value): |
884 def format_single_value(self, req, value): |
883 """return value suitable for display""" |
885 """return value suitable for display""" |
1198 return fieldclass(**kwargs) |
1200 return fieldclass(**kwargs) |
1199 return RelationField.fromcardinality(card, **kwargs) |
1201 return RelationField.fromcardinality(card, **kwargs) |
1200 |
1202 |
1201 |
1203 |
1202 FIELDS = { |
1204 FIELDS = { |
|
1205 'String' : StringField, |
|
1206 'Bytes': FileField, |
|
1207 'Password': PasswordField, |
|
1208 |
1203 'Boolean': BooleanField, |
1209 'Boolean': BooleanField, |
1204 'Bytes': FileField, |
|
1205 'Date': DateField, |
|
1206 'Datetime': DateTimeField, |
|
1207 'Int': IntField, |
1210 'Int': IntField, |
1208 'Float': FloatField, |
1211 'Float': FloatField, |
1209 'Decimal': StringField, |
1212 'Decimal': StringField, |
1210 'Password': PasswordField, |
1213 |
1211 'String' : StringField, |
1214 'Date': DateField, |
1212 'Time': TimeField, |
1215 'Datetime': DateTimeField, |
|
1216 'TZDatetime': DateTimeField, |
|
1217 'Time': TimeField, |
|
1218 'TZTime': TimeField, |
|
1219 # XXX implement 'Interval': TimeIntervalField, |
1213 } |
1220 } |