Ejemplo n.º 1
0
Archivo: forms.py Proyecto: tourist/lux
class ChangePasswordForm(PasswordForm):
    old_password = forms.PasswordField()

    layout = forms.Layout(forms.Fieldset('old_password', 'password',
                                         'password_repeat'),
                          forms.Submit('Update password',
                                       classes='btn btn-primary'),
                          showLabels=False)
Ejemplo n.º 2
0
Archivo: forms.py Proyecto: tourist/lux
class PasswordForm(forms.Form):
    password = forms.PasswordField(required=True, minlength=6, maxlength=128)
    password_repeat = forms.PasswordField(label='confirm password',
                                          data_check_repeat='password')

    layout = forms.Layout(forms.Fieldset('password', 'password_repeat'),
                          forms.Submit('Reset password',
                                       classes='btn btn-primary'),
                          showLabels=False)
Ejemplo n.º 3
0
Archivo: forms.py Proyecto: tourist/lux
class LoginForm(forms.Form):
    '''The Standard login form'''
    error_message = 'Incorrect username or password'
    username = forms.CharField(required=True, minlength=6, maxlength=30)
    password = forms.PasswordField(required=True, minlength=6, maxlength=128)

    layout = forms.Layout(forms.Fieldset(all=True),
                          forms.Submit('Login',
                                       classes='btn btn-primary btn-block',
                                       disabled="form.$invalid"),
                          showLabels=False)
Ejemplo n.º 4
0
Archivo: forms.py Proyecto: tourist/lux
class CreateUserForm(PasswordForm):
    username = forms.CharField(required=True, minlength=6, maxlength=30)
    email = forms.EmailField(required=True)

    layout = forms.Layout(forms.Fieldset('username', 'email', 'password',
                                         'password_repeat'),
                          forms.Submit('Sign up',
                                       classes='btn btn-primary btn-block',
                                       disabled="form.$invalid"),
                          showLabels=False,
                          directive='user-form')
Ejemplo n.º 5
0
class ContentForm(forms.Form):
    content_type = forms.CharField()
    title = forms.CharField(required=True)
    slug = forms.HiddenField(required=False)


    layout = forms.Layout(forms.Fieldset('title', show_label=False),
                          forms.Fieldset('body', show_label=False))

    def value_from_instance(self, instance, name, value):
        if name == 'body':
            return instance.data.get('body', '')
        else:
            return getattr(instance, name, value)

    def clean(self):
        data = self.cleaned_data
        slug = data.get('slug')
        if not slug:
            self.cleaned_data['slug'] = slugify(data['title'].lower())
        data['data'] = {'body': data.pop('body', '')}
Ejemplo n.º 6
0
class BlogAdmin(CRUDAdmin):
    icon = 'fa fa-book'
    form = forms.Layout(BlogForm)
Ejemplo n.º 7
0
Archivo: forms.py Proyecto: tourist/lux
class EmailForm(forms.Form):
    email = forms.EmailField(label='Enter your email address')

    layout = forms.Layout(forms.Fieldset(all=True),
                          forms.Submit('Submit', classes='btn btn-primary'),
                          showLabels=False)
Ejemplo n.º 8
0
 def on_loaded(self, app):
     app.forms['blog'] = forms.Layout(BlogForm)