Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix #79 : default in sequence of widgets

  • Loading branch information...
commit 09289918d45ded1c941c04bce5cec87e43d6bf5c 1 parent 2e95a1e
@tonthon authored
Showing with 14 additions and 12 deletions.
  1. +14 −12 deform/widget.py
View
26 deform/widget.py
@@ -271,31 +271,31 @@ class MoneyInputWidget(Widget):
symbol
the symbol to be used before of the user values. default: ``$``
-
+
showSymbol
set if the symbol must be displayed or not. default: ``False``
-
+
symbolStay
set if the symbol will stay in the field after the user exists the
field. default: ``False``
-
+
thousands
the thousands separator. default: ``,``
-
+
decimal
the decimal separator. default: ``.``
-
+
precision
how many decimal places are allowed. default: 2
defaultZero
when the user enters the field, it sets a default mask using zero.
default: ``True``
-
+
allowZero
use this setting to prevent users from inputing zero. default:
``False``
-
+
allowNegative
use this setting to prevent users from inputing negative values.
default: ``False``
@@ -305,7 +305,7 @@ class MoneyInputWidget(Widget):
requirements = ( ('jquery.maskMoney', None), )
options = None
size = None
-
+
def serialize(self, field, cstruct, readonly=False):
if cstruct in (null, None):
cstruct = ''
@@ -316,7 +316,7 @@ def serialize(self, field, cstruct, readonly=False):
options = json.dumps(dict(options))
return field.renderer(template, mask_options=options, field=field,
cstruct=cstruct)
-
+
def deserialize(self, field, pstruct):
if pstruct is null:
return null
@@ -1191,7 +1191,8 @@ def prototype(self, field):
# automated testing; finding last node)
item_field = field.children[0].clone()
proto = field.renderer(self.item_template, field=item_field,
- cstruct=null, parent=field)
+ cstruct=item_field.schema.serialize(null),
+ parent=field)
if isinstance(proto, string_types):
proto = proto.encode('utf-8')
proto = url_quote(proto)
@@ -1224,7 +1225,8 @@ def serialize(self, field, cstruct, readonly=False):
else:
# this serialization is being performed as a result of a
# first-time rendering
- subfields = [ (val, item_field.clone()) for val in cstruct ]
+ subfields = [ (item_field.schema.serialize(val),
+ item_field.clone()) for val in cstruct ]
template = readonly and self.readonly_template or self.template
translate = field.translate
@@ -1234,7 +1236,7 @@ def serialize(self, field, cstruct, readonly=False):
subitem_name=item_field.name)
if isinstance(self.add_subitem_text_template, TranslationString):
add_subitem_text = self.add_subitem_text_template % \
- add_template_mapping
+ add_template_mapping
else:
add_subitem_text = _(self.add_subitem_text_template,
mapping=add_template_mapping)
Please sign in to comment.
Something went wrong with that request. Please try again.