diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-17 12:04:08 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:41:54 +0200 | 
| commit | 0666e34337b965e85ce3920363ad04e87958e8e7 (patch) | |
| tree | 67d308063f0c78cbf26e3b040821e762fed5b4e3 /ishtar_common/forms_common.py | |
| parent | 022d362b707f0396461a1b32f001baab96a885fc (diff) | |
| download | Ishtar-0666e34337b965e85ce3920363ad04e87958e8e7.tar.bz2 Ishtar-0666e34337b965e85ce3920363ad04e87958e8e7.zip | |
WIP on account wizard. Wizard: can use switch for deletion. Better display of formsets on done wizard.
Diffstat (limited to 'ishtar_common/forms_common.py')
| -rw-r--r-- | ishtar_common/forms_common.py | 22 | 
1 files changed, 21 insertions, 1 deletions
| 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") | 
