Example #1
0
        class SiteSubInfoForm(OptionsForm):

            code = 'site_sub_info2'
            description = 'Sub site info'
            options = (('site_author', 'site_author_email'), )

            # options
            site_author = option(forms.CharField(max_length=100))
            site_author_email = option(forms.EmailField())
Example #2
0
    class SiteInfoForm(OptionsForm):

        code = 'site_info'
        title = 'Site information'
        description = 'small info'

        # options
        site_title = option(forms.CharField(max_length=255))
        site_description = option(forms.CharField(widget=forms.Textarea))
Example #3
0
        class SiteSubInfoForm(OptionsForm):

            code = 'site_sub_info'
            title = ''

            # options
            site_keywords = option(forms.CharField(widget=forms.Textarea))
            site_theme = option(
                forms.ChoiceField(choices=(
                    ('', '-- Empty --'),
                    ('basic', 'Basic theme'),
                    ('advanced', 'Advanced theme'),
                )))
Example #4
0
        class ProfileInfoForm(OptionsForm):

            code = 'user_profile'
            title = ''
            optionsets = (('User profile', {
                'fields': (
                    'avatar',
                    (
                        'password',
                        'password_confirm',
                    ),
                )
            }), )

            # options
            avatar = option(
                forms.FileField(widget=AdminFileWidget,
                                required=False,
                                initial=True))
            password = option(
                forms.CharField(max_length=255,
                                widget=forms.PasswordInput,
                                required=False))
            password_confirm = forms.CharField(max_length=255,
                                               widget=forms.PasswordInput,
                                               required=False)

            def clean(self):
                passphrase = self.cleaned_data.get('password')

                if passphrase:
                    passphrase_confirm = self.cleaned_data.get(
                        'password_confirm')
                    if passphrase != passphrase_confirm:
                        raise forms.ValidationError("Passwords not matches")

                return self.cleaned_data
Example #5
0
    class SiteInfoForm(OptionsForm):

        code = 'other_info'
        title = 'Other information'

        # options
        my_stuff = option(forms.CharField(max_length=255),
                          option_key='my.stuff')
        some_stuff = option(forms.CharField(max_length=255))
        other_stuff = option(
            forms.CharField(widget=forms.Textarea, required=False))

        optionsets = (
            (None, {
                'fields': ((
                    'my_stuff',
                    'some_stuff',
                ), )
            }),
            ('Advanced options', {
                'classes': ('collapse', ),
                'fields': ('other_stuff', )
            }),
        )