diff options
| author | Arnaud Bos <arnaud.tlse@gmail.com> | 2011-10-20 04:18:12 +0200 |
|---|---|---|
| committer | Arnaud Bos <arnaud.tlse@gmail.com> | 2011-10-20 04:18:12 +0200 |
| commit | 1e0898dd8770a19c45c934c4683def77b9497b3e (patch) | |
| tree | dea515e23dedc51b9bf07504d589ea9f9d7e9edc /budget/forms.py | |
| parent | 440ccb6e220f1cd7ea7f15de6f46c4a98e51d47c (diff) | |
| download | ihatemoney-mirror-1e0898dd8770a19c45c934c4683def77b9497b3e.zip ihatemoney-mirror-1e0898dd8770a19c45c934c4683def77b9497b3e.tar.gz ihatemoney-mirror-1e0898dd8770a19c45c934c4683def77b9497b3e.tar.bz2 | |
Last selected payer and translations. Fix #47.
- Last selected payer selected by default when creating a new bill
- Fix some translation typos and modify a few labels
Diffstat (limited to 'budget/forms.py')
| -rw-r--r-- | budget/forms.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/budget/forms.py b/budget/forms.py index d0a60ca..1fa8133 100644 --- a/budget/forms.py +++ b/budget/forms.py @@ -13,6 +13,13 @@ def select_multi_checkbox(field, ul_class='', **kwargs): kwargs.setdefault('type', 'checkbox') field_id = kwargs.pop('id', field.id) html = [u'<ul %s>' % html_params(id=field_id, class_="inputs-list")] + + choice_id = u'toggleField' + js_function = u'toggle();' + options = dict(kwargs, id=choice_id, onclick=js_function) + label = _("Select All/None") + html.append(u'<li><label for="%s">%s<span>%s</span></label></li>' % (choice_id, '<input %s /> ' % html_params(**options), label)) + for value, label, checked in field.iter_choices(): choice_id = u'%s-%s' % (field_id, value) options = dict(kwargs, name=field.name, value=value, id=choice_id) @@ -96,7 +103,7 @@ class BillForm(Form): what = TextField(_("What?"), validators=[Required()]) payer = SelectField(_("Payer"), validators=[Required()], coerce=int) amount = DecimalField(_("Amount payed"), validators=[Required()]) - payed_for = SelectMultipleField(_("Who has to pay for this?"), + payed_for = SelectMultipleField(_("For whom?"), validators=[Required()], widget=select_multi_checkbox, coerce=int) submit = SubmitField(_("Send the bill")) |
