From 0666e34337b965e85ce3920363ad04e87958e8e7 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 17 Apr 2018 12:04:08 +0200 Subject: WIP on account wizard. Wizard: can use switch for deletion. Better display of formsets on done wizard. --- ishtar_common/forms.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ishtar_common/forms.py') diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 70e144980..c314e4f13 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -193,6 +193,8 @@ class CustomForm(object): class FormSet(CustomForm, BaseFormSet): + delete_widget = widgets.DeleteWidget + def __init__(self, *args, **kwargs): self.readonly = False if 'readonly' in kwargs: @@ -240,7 +242,11 @@ class FormSet(CustomForm, BaseFormSet): setattr(form, clean.__name__, types.MethodType(clean, form)) if self.can_delete: form.fields[DELETION_FIELD_NAME].label = '' - form.fields[DELETION_FIELD_NAME].widget = widgets.DeleteWidget() + form.fields[DELETION_FIELD_NAME].widget = self.delete_widget() + + +class FormSetWithDeleteSwitches(FormSet): + delete_widget = widgets.DeleteSwitchWidget class FieldType(object): -- cgit v1.2.3