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_common.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'ishtar_common/forms_common.py') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 72b33b4c4..bde5e47ed 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -37,7 +37,7 @@ import widgets from bootstrap_datepicker.widgets import DatePicker from ishtar_common.templatetags.link_to_window import link_to_window from forms import FinalForm, FormSet, reverse_lazy, name_validator, \ - TableSelect, ManageOldType, CustomForm, FieldType + TableSelect, ManageOldType, CustomForm, FieldType, FormSetWithDeleteSwitches def get_town_field(label=_(u"Town"), required=True): @@ -721,6 +721,26 @@ class AccountForm(forms.Form): return cleaned_data +class ProfileForm(ManageOldType): + form_label = _("Profiles") + base_model = 'profile' + associated_models = {'profile_type': models.ProfileType} + profile_type = forms.ChoiceField(label=_(u"Type"), choices=[], + required=False) + pk = forms.IntegerField(label=" ", widget=forms.HiddenInput, required=False) + + TYPES = [ + FieldType('profile_type', models.ProfileType), + ] + + +ProfileFormset = formset_factory(ProfileForm, can_delete=True, + formset=FormSetWithDeleteSwitches) +ProfileFormset.form_label = _("Profiles") +ProfileFormset.form_admin_name = _(u"Profiles") +ProfileFormset.form_slug = "profiles" + + class FinalAccountForm(forms.Form): final = True form_label = _("Confirm") -- cgit v1.2.3