diff options
author | Leif Johansson <leifj@sunet.se> | 2011-02-28 22:07:19 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-02-28 22:07:19 +0100 |
commit | 77ceee6e23f2a8daaf5e3247970953313aebcdd3 (patch) | |
tree | 90665ac16c025ea1bc7b478f2c84dcebf437f393 /coip/apps/name/forms.py | |
parent | 36e045ed8aa871ef3bd0bf0e27896658d0a9ef89 (diff) |
wizards
Diffstat (limited to 'coip/apps/name/forms.py')
-rw-r--r-- | coip/apps/name/forms.py | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/coip/apps/name/forms.py b/coip/apps/name/forms.py index a2a659e..759579c 100644 --- a/coip/apps/name/forms.py +++ b/coip/apps/name/forms.py @@ -7,6 +7,7 @@ from django import forms from coip.apps.name.models import Name, Attribute, NameLink from django.forms import fields from django.forms.widgets import HiddenInput, CheckboxSelectMultiple +from form_utils.forms import BetterModelForm, BetterForm class NameForm(forms.ModelForm): class Meta: @@ -16,21 +17,42 @@ class AttributeForm(forms.ModelForm): class Meta: model = Attribute -class NameEditForm(forms.ModelForm): - description = forms.CharField(widget=forms.Textarea(attrs={'cols': 60, 'rows': 6})) - +class NameEditForm(BetterModelForm): + description = forms.CharField(widget=forms.Textarea(attrs={'cols': 60, 'rows': 6})) class Meta: model = Name fields = ['short','description'] - -class NewNameForm(forms.ModelForm): + fieldsets = [('step1', {'fields': ['short', 'description'], + 'legend': 'Describe your group', + 'classes': ['step submit_step'], + 'description': 'Provide a short and (optionally) longer description of your group..'})] + +class NewNameForm(BetterModelForm): description = forms.CharField(widget=forms.Textarea(attrs={'cols': 60, 'rows': 6})) + value = forms.CharField(label="Name") class Meta: model = Name - fields = ['type','value','short','description'] + fields = ['value','short','description','type'] + fieldsets = [('step1', {'fields': ['value'], + 'legend': 'Step 1: Name your group', + 'classes': ['step'], + 'description': 'Provide a short identifier for your groups. Spaces are not allowed here.'}), + ('step2', {'fields': ['short', 'description'], + 'legend': 'Step 2: Describe your group', + 'classes': ['step'], + 'description': 'Provide a short and (optionally) longer description of your group..'}), + ('step3', {'fields': ['type'], + 'legend': 'Step 3 (optional): Advanced options', + 'classes': ['step','submit_step'], + 'description': 'Only set the type if you know what you are doing. You almost certainly do not need this.'})] -class NameDeleteForm(forms.Form): +class NameDeleteForm(BetterForm): recursive = fields.BooleanField(label="Also delete everything below this name?",required=False) + class Meta: + fieldsets = [('step1', {'fields': ['recursive'], + 'legend': 'Confirm deletion of your group', + 'classes': ['step'], + 'description': 'This is a destructive operation - there is no way to recover your group once it has been deleted!'})] class NameLinkForm(forms.ModelForm): class Meta: |