Esempio n. 1
0
def UserFormHelper():
    """
    Helper for the user edit form
    """
    helper = FormHelper()
    helper.form_action = '.'
    helper.layout = Layout(
        Fieldset(
            _('Identity'),
            Row(Column('email', css_class='twelve'), ),
            Row(
                Column('first_name', css_class='six'),
                Column('last_name', css_class='six'),
            ),
        ),
        Fieldset(
            _('Password'),
            Row(
                Column('new_password1', css_class='twelve'),
                Column('new_password2', css_class='twelve'),
            ),
        ),
        Row(
            Column(ButtonHolder(Submit('submit', _('Submit')),
                                css_class="text-right"),
                   css_class='twelve'), ))

    return helper
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_method = 'post'

        self.helper.layout = Layout(
            Fieldset(
                u'Général',
                Field('title'),
                Field('image'),
            ),
            Fieldset(
                u'Contenu',
                Field('introduction'),
                Field('conclusion')
            ),
            ButtonHolder(
                Div(
                    Submit('submit', 'Ajouter'),
                    Submit(
                        'submit_continue', 'Ajouter et continuer',
                        css_class='secondary'),
                    css_class='button-group'
                ),
            )
        )
        super(ChapterForm, self).__init__(*args, **kwargs)
Esempio n. 3
0
def test_advanced(output_test_path, render_output, rendered_template, helper, client):
    form = AdvancedForm()
    pack = helper.template_pack

    helper.layout = Layout(
        Row(
            Column(
                'simple',
                css_class='six'
            ),
            Column(
                'opt_in',
                css_class='six'
            ),
        ),
        Row(
            Column(
                'longtext'
            ),
        ),
        Row(
            Column(
                ButtonHolder(Submit('submit', 'Submit')),
            ),
            css_class='large'
        ),
    )

    rendered = rendered_template(form, helper=helper)

    attempted = render_output(os.path.join(output_test_path, pack,
                                           'test_advanced.html'))
    #write_output(output_test_path, pack, "test_advanced.html", rendered)

    assert parse_html(attempted) == parse_html(rendered)
Esempio n. 4
0
    def __init__(self, *args, **kwargs):
        super(ChallengeFileModelForm, self).__init__(*args, **kwargs)

        self.add_helper = FormHelper()
        self.add_helper.form_id = 'add-file'
        self.add_helper.form_method = 'post'
        self.add_helper.form_action = ''

        self.update_helper = FormHelper()
        self.update_helper.form_id = 'update-file'
        self.update_helper.form_method = 'post'
        self.update_helper.form_action = ''

        holder = ButtonHolder(
            Submit('submit', 'Submit'),
            Reset('reset', 'Reset'),
            css_class='text-right'
        )

        self.add_helper.layout = Layout(
            Fieldset(
                'Add a file',
                HTML('<p>Original filenames are preserved whenever possible.</p>'),
                'file',
            ),
            holder
        )

        self.update_helper.layout = Layout(
            Fieldset(
                'Update a file',
                'file',
            ),
            holder
        )
Esempio n. 5
0
 def __init__(self, *args, **kwargs):
     super(HashForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'hash-form'
     self.helper.form_method = 'post'
     self.helper.form_action = reverse("tools_hash")
     self.helper.layout = Layout(
         Fieldset('Hashing Tools', 'hash_type', 'value', 'result'),
         ButtonHolder(Submit('submit', 'Submit'),
                      Reset('reset', 'Reset'),
                      css_class='text-right'))
Esempio n. 6
0
 def __init__(self, *args, **kwargs):
     super(URLUnquoteForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'unquote-form'
     self.helper.form_method = 'post'
     self.helper.form_action = reverse('tools_unquote')
     self.helper.layout = Layout(
         Fieldset('URL Decoding', 'value', 'result'),
         ButtonHolder(Submit('submit', 'Submit'),
                      Reset('reset', 'Reset'),
                      css_class='text-right'))
Esempio n. 7
0
 def __init__(self, *args, **kwargs):
     super(XORForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'xor-form'
     self.helper.form_method = 'post'
     self.helper.form_action = reverse("tools_xor")
     self.helper.layout = Layout(
         Fieldset('String XOR Tool', 'value', 'key', 'result'),
         ButtonHolder(Submit('submit', 'Submit'),
                      Reset('reset', 'Reset'),
                      css_class='text-right'))
Esempio n. 8
0
 def __init__(self, *args, **kwargs):
     super(DeleteForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Fieldset(
             'Are you sure you want to delete "{0}"?'.format(self.instance),
             Row(
                 Column(ButtonHolder(
                     Submit('submit', 'Delete', css_class='alert'),
                     HTML('<a class="button secondary" href="' +
                          self.get_cancel_url() + '">Go Back</a>')),
                        css_class='small-12'))))
Esempio n. 9
0
 def __init__(self, *args, **kwargs):
     super(BaseConversionForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'base-conversion-form'
     self.helper.form_method = 'post'
     self.helper.form_action = reverse("tools_base_conversion")
     self.helper.layout = Layout(
         Fieldset('Base Conversion Tool', 'value', 'base', 'currBase',
                  'result'),
         ButtonHolder(Submit('submit', 'Submit'),
                      Reset('reset', 'Reset'),
                      css_class='text-right'))
Esempio n. 10
0
 def __init__(self, *args, **kwargs):
     super(RotForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'rot-form'
     self.helper.form_method = 'post'
     self.helper.form_action = reverse("tools_rot")
     self.helper.layout = Layout(
         Fieldset('ROT=* Encoder/Decoder', 'rot_type', 'value', 'encode',
                  'result'),
         ButtonHolder(Submit('submit', 'Submit'),
                      Reset('reset', 'Reset'),
                      css_class='text-right'))
    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_action = '.'
        self.helper.layout = Layout(
            Fieldset(
                _('User'),
                Row(
                    Column('username', css_class='six'),
                    Column(Row(
                        Column('password1', css_class='six unpadded'),
                        Column('password2', css_class='six unpadded'),
                    ),
                           css_class='six'),
                ),
            ),
            Fieldset(
                _('Society'),
                Row(
                    Column('company', css_class='six'),
                    Column('function', css_class='six'),
                ),
            ),
            Fieldset(
                _('Personal details'),
                Row(
                    Column(Row(
                        Column('first_name', css_class='six unpadded'),
                        Column('last_name', css_class='six unpadded'),
                    ),
                           css_class='six'),
                    Column('email', css_class='six'),
                ),
                Row(
                    Column('address', css_class='six'),
                    Column(Row(
                        Column('city', css_class='eight unpadded'),
                        Column('postal_code', css_class='four unpadded'),
                        Column('country', css_class='six unpadded'),
                        Column('phone', css_class='six unpadded'),
                    ),
                           css_class='six'),
                ),
            ),
            Row(
                Column(ButtonHolder(Submit('submit', _('Submit')),
                                    css_class="text-right"),
                       css_class='twelve'), ))

        super(RegistrationFormAccounts, self).__init__(*args, **kwargs)
Esempio n. 12
0
    def __init__(self, *args, user: User, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['category'].queryset = user.category_set.all()
        self.fields['transport_used'].label = "Votre mode de transport"

        self.helper = FormHelper()
        self.helper.form_action = '.'
        self.helper.layout = Layout(
            Fieldset("{{ user.username|title }}, ou voulez-vous aller ?",
                     'category',
                     'transport_used',
                     ),
            ButtonHolder(
                Submit('submit', "C'est parti!"),
            ),
        )
Esempio n. 13
0
    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_method = 'post'

        self.helper.layout = Layout(
            Fieldset(
                u'Contenu',
                Field('image'),
                Field('introduction'),
                Field('conclusion')
            ),
            ButtonHolder(
                Submit('submit', 'Valider')
            )
        )
        super(EmbdedChapterForm, self).__init__(*args, **kwargs)
Esempio n. 14
0
def RegistrationFormHelper():
    """
    Helper for the user registration form
    """
    helper = FormHelper()
    helper.form_action = '.'
    helper.layout = Layout(
        Row(Column('email', 'username', css_class='twelve'), ),
        Row(
            Column('password1', css_class='six'),
            Column('password2', css_class='six'),
        ), Row(Column('captcha', css_class='twelve'), ),
        Row(
            Column(ButtonHolder(Submit('submit', _('Submit')),
                                css_class="text-right"),
                   css_class='twelve'), ))

    return helper
Esempio n. 15
0
 def __init__(self, *args, **kwargs):
     super(PhotoForm, self).__init__(*args, **kwargs)
     if 'content_object' in kwargs['initial']:
         context_object = kwargs['initial']['content_object']
         self.instance.content_object = context_object
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Fieldset(
             'Photo', Row(Column('image', css_class='small-12'), ),
             Row(
                 Column('caption', css_class='small-12 medium-9'),
                 Column('priority', css_class='small-12 medium-3'),
             )),
         ButtonHolder(
             Submit('submit', 'Save'),
             HTML('<a class="button secondary" href="' +
                  self.instance.content_object.get_absolute_url() +
                  '">Cancel</a>')))
Esempio n. 16
0
 def __init__(self, *args, **kwargs):
     super(LoginForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'login-form'
     self.helper.attrs = {'data_abide': ''}
     self.helper.form_method = 'post'
     self.helper.form_action = ''
     self.helper.layout = Layout(
         Fieldset(
             '',
             'username',
             'password'
         ),
         ButtonHolder(
             Reset('reset', 'Reset', css_class='secondary'),
             Submit('submit', 'Submit'),
             css_class='buttons text-right'
         )
     )
Esempio n. 17
0
    def __init__(self, *args, **kwargs):
        super(PasswordChangeForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_id = 'pw-change-form'
        self.helper.form_method = 'post'
        self.helper.form_action = ''
        self.helper.layout = Layout(
            Fieldset(
                'Change password',
                'old_password',
                'new_password1',
                'new_password2'
            ),
            ButtonHolder(
                Submit('submit', 'Submit'),
                Reset('reset', 'Reset'),
                css_class='text-right'
            )
        )
Esempio n. 18
0
    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_method = 'post'

        self.helper.layout = Layout(
            Fieldset(
                u'Général',
                Field('title'),
                Field('tutorial'),
            ),
            Fieldset(
                u'Contenu',
                Field('introduction'),
                Field('conclusion')
            ),
            ButtonHolder(
                Submit('submit', 'Valider'),
            )
        )
        super().__init__(*args, **kwargs)
Esempio n. 19
0
 def __init__(self, *args, **kwargs):
     super(ReviewForm, self).__init__(*args, **kwargs)
     if 'builder' in kwargs['initial']:
         builder = kwargs['initial']['builder']
         self.instance.builder = builder
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Fieldset(
             'Basic Information',
             Row(Column('costume_name', css_class='small-12')),
             Row(Column('commission_date', css_class='small-12 medium-6'),
                 Column('received_date', css_class='small-12 medium-6')),
         ), Fieldset('Details', Row(Column('text', css_class='small-12'))),
         Fieldset('Rating',
                  Div('construction', 'communication', 'timeliness')),
         ButtonHolder(
             Submit('submit', 'Save'),
             HTML('<a class="button secondary" href="' +
                  (self.instance.get_absolute_url() if self.instance.
                   pk is not None else builder.get_absolute_url()) +
                  '">Cancel</a>')))
Esempio n. 20
0
 def __init__(self, *args, **kwargs):
     self.kuser = kwargs.pop('kituser') or None
     
     super(ContactGroupForm, self).__init__(*args, **kwargs)
     
     self.fields['contacts'].queryset = self.kuser.get_contacts()
     
     self.helper = FormHelper()
     self.helper.form_action = '.'
     self.helper.layout = Layout(
         Div(
             'title',
             'description',
             HTML('<a href="#" title="Insert All Contacts" id="sel-all-contacts" class="button tiny" style="float: right; margin-bottom: 3px;">All Contacts</a>'),
             'contacts'
         ),
         ButtonHolder(
             Submit('submit', _('Submit'), css_class="success float-right"),
             Reset('reset', _('Reset'), css_class="float-right")
         )
     )
Esempio n. 21
0
    def __init__(self, *args, **kwargs):
        super(EmailChangeForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_id = 'email-change-form'
        self.helper.form_method = 'post'
        self.helper.form_action = ''
        self.helper.layout = Layout(
            Fieldset(
                'Change email',
                HTML(
                    '''<p><label class="control-label">Current Email Address: </label><span style="padding-left: 2em;">{{ user.email }}</span></p>'''),
                'email',
                'password'
            ),
            ButtonHolder(
                Submit('submit', 'Submit'),
                Reset('reset', 'Reset'),
                css_class='text-right'
            )
        )
Esempio n. 22
0
    def __init__(self, *args, **kwargs):
        super(ChallengeModelForm, self).__init__(*args, **kwargs)

        self.add_helper = FormHelper()
        self.add_helper.form_id = 'add-challenge'
        self.add_helper.form_method = 'post'
        self.add_helper.form_action = ''

        self.update_helper = FormHelper()
        self.update_helper.form_id = 'update-challenge'
        self.update_helper.form_method = 'post'
        self.update_helper.form_action = ''

        holder = ButtonHolder(
            Submit('submit', 'Submit'),
            Reset('reset', 'Reset'),
            css_class='text-right'
        )

        self.add_helper.layout = Layout(
            Fieldset(
                'Add a challenge',
                'name',
                'point_value',
                'progress',
                'num_progress'
            ),
            holder
        )

        self.update_helper.layout = Layout(
            Fieldset(
                'Update a challenge',
                'name',
                'point_value',
                'progress',
                'num_progress'
            ),
            holder
        )
Esempio n. 23
0
 def __init__(self, *args, **kwargs):
     super(BuilderForm, self).__init__(*args, **kwargs)
     self.fields['other_sites'].initial = '\n'.join(
         x.url for x in self.instance.other_sites.all())
     self.helper = FormHelper()
     self.helper.layout = Layout(
         Fieldset(
             'The Basics',
             Row(Column('name', css_class='small-12 medium-6'),
                 Column('status', css_class='small-12 medium-6')),
             Row(Column('description', css_class='small-12'))),
         Fieldset('More Information', 'other_sites'),
         Fieldset(
             'Look & Feel',
             Row(
                 Column('thumb', css_class='small-12 medium-6'),
                 Column('banner', css_class='small-12 medium-6'),
             )), Fieldset('Administration', 'users'),
         ButtonHolder(
             Submit('submit', 'Save'),
             HTML('<a class="button secondary" href="' +
                  self.instance.get_absolute_url() + '">Cancel</a>')))
Esempio n. 24
0
    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_method = 'post'

        self.helper.layout = Layout(
            Fieldset(
                u'Général',
                Field('title'),
                Field('image'),
                Field('part'),
                Field('chapter'),
            ),
            Fieldset(
                u'Contenu',
                Field('introduction'),
                Field('conclusion'),
            ),
            ButtonHolder(
                Submit('submit', u'Sauvegarder les modifications'),
            )
        )
        super().__init__(*args, **kwargs)
Esempio n. 25
0
    def __init__(self, *args, **kwargs):
        super(CompetitionModelForm, self).__init__(*args, **kwargs)
        self.add_helper = FormHelper()
        self.add_helper.form_id = 'add-ctf'
        self.add_helper.form_method = 'post'
        self.add_helper.form_action = ''

        self.update_helper = FormHelper()
        self.update_helper.form_id = 'update-ctf'
        self.update_helper.form_method = 'post'
        self.update_helper.form_action = ''

        button_holder = ButtonHolder(
            Submit('submit', 'Submit'),
            Reset('reset', 'Reset'),
            css_class='text-right'
        )

        self.add_helper.layout = Layout(
            Fieldset(
                'Add a competition',
                'name',
                'url',
                'start_time',
                'end_time'
            ),
            button_holder
        )

        self.update_helper.layout = Layout(
            Fieldset(
                'Update competition',
                'name',
                'url',
                'start_time',
                'end_time'
            ),
            button_holder
        )
Esempio n. 26
0
 def __init__(self, *args, **kwargs):
     super(RegistrationForm, self).__init__(*args, **kwargs)
     self.helper = FormHelper()
     self.helper.form_id = 'registration-form'
     self.helper.form_method = 'post'
     self.helper.form_action = reverse("register")
     self.helper.layout = Layout(
         Fieldset(
             '',
             'username',
             'first_name',
             'last_name',
             'email',
             'password1',
             'password2'
         ),
         ButtonHolder(
             Submit('submit', 'Submit'),
             Reset('reset', 'Reset'),
             css_class='text-right'
         )
     )