コード例 #1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.form_method = 'get'
        self.form_id = 'frmComunicacion'
        # self.form_action = "{% url 'prueba:filter_modal' %}"
        # self.form_action = "/prueba/filter_modal"

        self.layout = layout.Layout(
            layout.Div(
                layout.Fieldset(
                    None,
                    layout.Div(
                        bootstrap.InlineField("tipo", wrapper_class="col-4"),
                        bootstrap.InlineField("texto", wrapper_class="col-5"),
                        bootstrap.InlineField("active", wrapper_class="col-3"),
                        css_class="row",
                    ),
                    css_class="col-10",
                ),
                bootstrap.FormActions(
                    # layout.Submit("submit", "Buscar", css_id="btnBuscar"),
                    layout.Button('btnFilter',
                                  'Buscar',
                                  css_id='btnFilter',
                                  css_class='btn btn-sm btn-primary',
                                  onclick='submit_modal(frmComunicacion);'),
                    css_class="col-2 text-right align-self-center",
                ),
                css_class="row",
            ))
コード例 #2
0
class ComunicacionFilterFormHelper(helper.FormHelper):
    form_class = "form form-inline"
    form_id = "comunicacion-search-form"
    form_method = "GET"
    form_tag = True
    html5_required = True
    layout = layout.Layout(
        layout.Div(
            layout.Fieldset(
                "<span class='fa fa-search'></span> Búsqueda de Comunicaciones",
                layout.Div(
                    bootstrap.InlineField("id", wrapper_class="col-4"),
                    bootstrap.InlineField("tipo", wrapper_class="col-4"),
                    bootstrap.InlineField("texto", wrapper_class="col-4"),
                    bootstrap.InlineField("active", wrapper_class="col-4"),
                    css_class="row",
                ),
                css_class="col-11 border p-3",
            ),
            bootstrap.FormActions(
                layout.Submit("submit", "Filtrar"),
                css_class="col-1 text-right align-self-center",
            ),
            css_class="row",
        ))
コード例 #3
0
ファイル: forms.py プロジェクト: giohappy/smb-portal
 def __init__(self, *args, **kwargs):
     self.bike = kwargs.pop("bike", None)
     is_ajax = kwargs.pop("is_ajax", None)
     action = kwargs.pop("action", None)
     super().__init__(*args, **kwargs)
     self.instance.gallery = self.bike.picture_gallery
     self.helper = FormHelper()
     if action is not None:
         self.helper.form_action = action
     self.helper.layout = layout.Layout(
         layout.Field("image"),
     )
     form_id = "bikePictureForm"
     self.helper.form_id = form_id
     if not is_ajax:
         self.helper.layout.append(
             bootstrap.FormActions(
                 bootstrap.StrictButton(
                     mark_safe('<i class="fa fa-upload"></i> ') + _(
                         "Upload picture"),
                     type="submit",
                     form=form_id,
                     css_class="btn btn-primary"
                 ),
             )
         )
コード例 #4
0
    def build_default_layout(self, form):
        layout = cfl.Layout(*form.fields.keys())

        if self.kwargs.get('legend_text'):
            layout.insert(
                0,
                cfl.HTML(u"<legend>{}</legend>".format(
                    self.kwargs.get('legend_text'))))

        if self.kwargs.get('help_text'):
            layout.insert(
                1,
                cfl.HTML("""<p class="help-block">{}</p><br>""".format(
                    self.kwargs.get('help_text'))))

        if self.kwargs.get('cancel_url'):
            layout.append(
                cfb.FormActions(
                    cfl.Submit('save', 'Save'),
                    cfl.HTML(
                        """<a role="button" class="btn btn-default" href="{}">Cancel</a>"""
                        .format(self.kwargs.get('cancel_url'))),
                ))

        return layout
コード例 #5
0
ファイル: forms.py プロジェクト: bishwobhandari/hawc
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs["class"] = "span12"

        inputs = {
            "legend_text": "Password reset",
            "help_text": """
                Enter your email address below, and we'll email instructions
                for setting a new password.
            """,
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit("submit", "Send email confirmation"),
                cfl.HTML(
                    f'<a role="button" class="btn btn-default" href="{reverse("user:login")}">Cancel</a>'
                ),
            )
        )

        return helper
コード例 #6
0
ファイル: forms.py プロジェクト: bishwobhandari/hawc
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs["class"] = "span12"

        inputs = {
            "legend_text": "Password reset",
            "help_text": "Enter a new password for your account.",
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        cancel_url = reverse("user:login")
        helper.layout.append(
            cfb.FormActions(
                cfl.Submit("submit", "Change password"),
                cfl.HTML(
                    f'<a role="button" class="btn btn-default" href="{cancel_url}">Cancel</a>'
                ),
            )
        )

        return helper
コード例 #7
0
ファイル: forms.py プロジェクト: bishwobhandari/hawc
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs["class"] = "span12"

        inputs = {"legend_text": "Create an account"}

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        login_url = reverse("user:login")
        helper.layout.extend(
            [
                cfl.HTML(
                    '<a class="btn btn-small" href="#license_modal" data-toggle="modal">View License</a>'
                ),
                cfb.FormActions(
                    cfl.Submit("login", "Create account"),
                    cfl.HTML(
                        f'<a role="button" class="btn btn-default" href="{login_url}">Cancel</a>'
                    ),
                ),
            ]
        )

        return helper
コード例 #8
0
 def default_bootstrap_layout(self, form, actions=None):
     actions = [] if actions is None else actions
     form_fields = []
     small_fields = (forms.ChoiceField, forms.IntegerField,
                     forms.DateTimeField)
     for name, field in form.fields.items():
         attrs = {}
         if isinstance(field, small_fields):
             attrs['field_class'] = 'col-lg-2 col-md-3 col-xs-4'
         if isinstance(field.widget, forms.widgets.MultiWidget):
             form_fields.append(
                 CrispyMultiWidgetField(name, wrapper_class='multifield'))
         else:
             form_fields.append(CrispyField(name, **attrs))
     form_layout = layout.Layout(*form_fields)
     form_actions = []
     for action in actions:
         if action['type'] == 'submit':
             args = {}
             if 'class' in action:
                 args['css_class'] = 'btn-{0}'.format(action['class'])
             form_actions.append(
                 layout.Submit(action['name'], action['value'], **args))
         if action['type'] == 'reset':
             args = {}
             if 'class' in action:
                 args['css_class'] = 'btn-{0}'.format(action['class'])
             form_actions.append(
                 layout.Reset(action['name'], action['value'], **args))
     if not actions:
         form_actions.append(layout.Submit('submit', 'Submit'))
     form_layout.append(bootstrap.FormActions(*form_actions))
     return form_layout
コード例 #9
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.form_method = 'get'
        self.form_id = 'frmDomicilio'

        self.layout = layout.Layout(
            layout.Div(
                layout.Fieldset(
                    None,
                    layout.Div(
                        bootstrap.InlineField("nombre", wrapper_class="col-5"),
                        bootstrap.InlineField("numero", wrapper_class="col-4"),
                        bootstrap.InlineField("active", wrapper_class="col-3"),
                        css_class="row",
                    ),
                    css_class="col-10",
                ),
                bootstrap.FormActions(
                    # layout.Submit("submit", "Buscar", css_id="btnBuscar"),
                    layout.Button('btnFilter', 'Buscar', 
                                  css_id='btnFilter', 
                                  css_class='btn btn-sm btn-primary', 
                                  onclick='submit_modal(frmDomicilio);'),
                    css_class="col-2 text-right align-self-center",
                ),
                css_class="row",
            )
        )
コード例 #10
0
ファイル: forms.py プロジェクト: shanethacker/hawc
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) not in [forms.CheckboxInput, forms.CheckboxSelectMultiple]:
                widget.attrs['class'] = 'span12'

        helper = BaseFormHelper(self)

        helper.form_method = "GET"
        helper.form_class = None

        helper.add_fluid_row('studies', 4, "span3")
        helper.add_fluid_row('species', 4, "span3")
        helper.add_fluid_row('name', 4, "span3")
        helper.add_fluid_row('tags', 4, "span3")

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('submit', 'Apply filters'),
            )
        )

        return helper
コード例 #11
0
ファイル: forms_utils.py プロジェクト: florzanetta/lumina
    def __init__(self, *args, **kwargs):
        assert self.FORM_TITLE is not None
        assert self.SUBMIT_LABEL is not None
        assert self.FIELDS

        super().__init__(*args, **kwargs)
        self.helper = helper.FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'

        fields = [
            self._get_crispy_form_field(field_name)
            for field_name in self.FIELDS
        ]

        form_actions = (
            layout.Submit('submit_button',
                          self.SUBMIT_LABEL,
                          css_id='form-submit-button'),
            layout.HTML(
                "<a class='btn btn-primary' href='{}'>Cancelar</a>".format(
                    self.get_cancel_url())),
        )

        if self.HELP_LINK:
            form_actions += (layout.HTML("""
                    <span style="padding-left: 1em;"><a href="{0}" target="_blank"><i
                        class="fa fa-life-ring"></i> Ayuda</a></span>
                """.format(self.HELP_LINK)), )

        self.helper.layout = helper.Layout(
            layout.Fieldset(self.FORM_TITLE, *fields),
            bootstrap.FormActions(*form_actions),
        )
コード例 #12
0
ファイル: forms.py プロジェクト: wschwab3/hawc
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {"legend_text": "HAWC login"}

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('login', 'Login'),
                cfl.HTML(
                    """<a role="button" class="btn btn-default" href="{}">Cancel</a>"""
                    .format(reverse('home'))), cfl.HTML("""<br><br>"""),
                cfl.HTML(
                    """<a href="{0}">Forgot your password?</a><br>""".format(
                        reverse('user:reset_password'))),
                cfl.HTML("""<a href="{0}">Create an account</a><br>""".format(
                    reverse('user:new')))))

        return helper
コード例 #13
0
ファイル: forms.py プロジェクト: wschwab3/hawc
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {
            "legend_text": "Password reset",
            "help_text": "Enter a new password for your account."
        }

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.append(
            cfb.FormActions(
                cfl.Submit('submit', 'Change password'),
                cfl.HTML(
                    """<a role="button" class="btn btn-default" href="{}">Cancel</a>"""
                    .format(reverse('user:login'))),
            ))

        return helper
コード例 #14
0
ファイル: forms.py プロジェクト: florzanetta/lumina
    def __init__(self, user=None, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = helper.FormHelper()
        self.helper.form_action = 'image_list'
        self.helper.form_id = 'form-image-search'

        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'

        assert isinstance(user, LuminaUser)
        assert user.is_photographer()

        self.helper.layout = helper.Layout(
            forms_utils.DatePickerField('fecha_creacion_desde'),
            forms_utils.DatePickerField('fecha_creacion_hasta'),
            'customer',
            'session_type',
            'page',
            bootstrap.FormActions(
                layout.Submit('submit_button',
                              'Buscar',
                              css_id='form-submit-button'), ),
        )
        self.fields['customer'].queryset = Customer.objects.customers_of(user)
        self.fields[
            'session_type'].queryset = SessionType.objects.for_photographer_ordered(
                user)
コード例 #15
0
ファイル: forms.py プロジェクト: florzanetta/lumina
    def __init__(self, *args, **kwargs):
        photographer = kwargs.pop('photographer')
        session = kwargs.pop('session')

        super().__init__(*args, **kwargs)
        self.helper = helper.FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'

        self.helper.layout = helper.Layout(
            layout.Fieldset(
                'Creación de solicitud de imágenes',
                'image_quantity',
                'preview_size',
            ),
            bootstrap.FormActions(
                layout.Submit('submit_button',
                              'Crear solicitud',
                              css_id='form-submit-button'), ),
        )

        assert isinstance(photographer, LuminaUser)
        assert photographer.is_photographer()

        assert isinstance(session, models.Session)

        self.instance.session = session

        self.fields[
            'preview_size'].queryset = models.PreviewSize.objects.for_photographer_ordered(
                photographer)
コード例 #16
0
    def __init__(self, *args, **kwargs):
        super(TagNewForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "POST"

        self.helper.layout = layout.Layout(
            # layout.Fieldset(
            #     _("Main data"),
            #     layout.Field("hashtag_text", css_class="input-block-level"),
            # ),
            layout.Field("hashtag_text", css_class="input-block-level"),
            bootstrap.FormActions(layout.Submit('submit', _('Save')), ))


# class TagNewProcessForm(forms.Form):
#     politician = forms.ModelChoiceField
#     new_tag = forms.CharField(
#         label=_("New Tag Label"),
#         queryset=Tag.object.all(),
#         required=True,
#     )
#
#     def __init__(self, request, *args, **kwargs):
#         super(TagNewProcessForm, self).__init__(*args, **kwargs)
#         self.request = request
#         self.fields['new_tag'].queryset = self.fields['new_tag'].queryset.exclude()
コード例 #17
0
    def setHelper(self):

        # by default take-up the whole row-fluid
        for fld in list(self.fields.keys()):
            widget = self.fields[fld].widget
            if type(widget) != forms.CheckboxInput:
                widget.attrs['class'] = 'span12'

        inputs = {"legend_text": "Create an account"}

        helper = BaseFormHelper(self, **inputs)
        helper.form_class = "loginForm"

        helper.layout.extend([
            cfl.HTML(
                '''<a class="btn btn-small" href="#license_modal" data-toggle="modal">View License</a>'''
            ),
            cfb.FormActions(
                cfl.Submit('login', 'Create account'),
                cfl.HTML(
                    """<a role="button" class="btn btn-default" href="{}">Cancel</a>"""
                    .format(reverse('user:login'))),
            )
        ])

        return helper
コード例 #18
0
    def __init__(self, *args, **kwargs):
        super(ContactForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-5'
        self.helper.field_class = 'col-lg-7'
        self.helper.form_action = ""
        self.helper.form_method = "POST"

        self.helper.layout = layout.Layout(
            layout.Div(layout.HTML(
                u"""<div class="panel-heading"><h3 class="panel-title">Write your email and your request </h3></div>"""
            ),
                       layout.Div(
                           layout.Div(
                               layout.Field('email_contact'),
                               css_class="col-md-10",
                           ),
                           layout.Div(
                               layout.Field('subject'),
                               css_class="col-md-10",
                           ),
                           layout.Div(
                               layout.Field('message'),
                               css_class="col-md-10",
                           ),
                           layout.Div(bootstrap.FormActions(
                               layout.Reset(('Reset'), _('Reset')),
                               layout.Submit(('submit'),
                                             _('Submit'),
                                             style='margin-left: 80px')),
                                      css_class="col-md-10"),
                           css_class="row panel-body",
                       ),
                       css_class="panel panel-default"), )
コード例 #19
0
class DomicilioFilterFormHelper_OLD(helper.FormHelper):
    form_class = "form form-inline"
    form_id = "domicilio-search-form"
    form_method = "GET"
    form_tag = True
    html5_required = True
    layout = layout.Layout(
        layout.Div(
            layout.Fieldset(
                "<span class='fa fa-search'></span> Búsqueda de Domicilios",
                layout.Div(
                    bootstrap.InlineField("id", wrapper_class="col-2"),
                    bootstrap.InlineField("nombre", wrapper_class="col-8"),
                    bootstrap.InlineField("active", wrapper_class="col-2"),
                    css_class="row",
                ),
                css_class="col-11 border p-3",
            ),
            bootstrap.FormActions(
                layout.Submit("submit", "Filtrar"),
                css_class="col-1 text-right align-self-center",
            ),
            css_class="row",
        )
    )
コード例 #20
0
ファイル: forms.py プロジェクト: manlan2/imageuploads
    def __init__(self, *args, **kwargs):
        super(ImageForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_action = ""
        self.helper.form_method = "POST"

        self.helper.layout = layout.Layout(
            layout.Fieldset(
                _("Image form"),
                "title",
                layout.HTML(u"""{% load i18n %}
                    <div id="image_upload_widget">
                        <div class="preview">
                            {% if instance.image %}
                                <img src="{{ MEDIA_URL }}{{ instance.image }}" alt="" />
                            {% endif %}
                        </div>
                        <div class="uploader">
                            <noscript>
                                <p>{% trans "Please enable JavaScript to use file uploader." %}</p>
                            </noscript>
                        </div>
                        <p class="help_text" class="help-block">{% trans "Available formats are JPG, GIF, and PNG." %}</p>
                        <div class="messages"></div>
                    </div>
                """),
                "image_path",
                "delete_image",
            ),
            bootstrap.FormActions(
                layout.Submit('submit', _('Save'),
                              css_class="btn btn-primary"), ))
コード例 #21
0
    def __init__(self, *args, **kwargs):
        super(TimeDelivery, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-4'
        self.helper.field_class = 'col-lg-7'
        self.helper.form_action = ""
        self.helper.form_method = "POST"

        self.helper.layout = layout.Layout(
            layout.Div(layout.HTML(
                u"""<div class="panel-heading"><h3 class="panel-title">Form for getting the delivery time for the requested services</h3></div>"""
            ),
                       layout.Div(
                           layout.Div(
                               layout.Field('start_date'),
                               css_class="col-md-10",
                           ),
                           layout.Div(
                               layout.Field('end_date'),
                               css_class="col-md-10",
                           ),
                           layout.Div(bootstrap.FormActions(
                               layout.Reset(('Reset'), _('Reset')),
                               layout.Submit(('submit'),
                                             _('Submit'),
                                             style='margin-left: 80px')),
                                      css_class="col-md-10"),
                           css_class="row panel-body",
                       ),
                       css_class="panel panel-default"), )
コード例 #22
0
    def __init__(self, *args, **kwargs):
        super(AddDeliveryService, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-4'
        self.helper.field_class = 'col-lg-7'
        self.helper.form_action = ""
        self.helper.form_method = "POST"

        self.helper.layout = layout.Layout(
            layout.Div(
                layout.HTML(
                    u"""<div class="panel-heading"><h3 class="panel-title">Delivery Form for Service </h3></div>"""
                ),
                layout.Div(
                    layout.Div(
                        layout.Field('deliveryNotes'),
                        css_class="col-md-10",
                    ),
                    layout.Div(
                        bootstrap.FormActions(
                            layout.Reset(('Reset'), _('Reset')),
                            layout.Submit(('submit'),
                                          _('Save'),
                                          style='margin-left: 80px')),
                        #layout.Submit(('submit'),_('Save'), css_class= "col-md-2 offset-md-3")),
                        css_class="col-md-10"),
                    css_class="row panel-body",
                ),
                css_class="panel panel-default"), )
コード例 #23
0
 def get_form_helper(self):
     helper = FormHelper()
     helper.form_style = 'default'
     helper.form_show_labels = True
     helper.layout = crispy.Layout(
         crispy.Div(
             crispy.Field('id'),
             crispy.Field('column'),
             crispy.Field('data_element_id'),
             crispy.Field('category_option_combo_id'),
             crispy.Field('comment'),
             css_class='modal-body',
         ),
         twbscrispy.FormActions(
             twbscrispy.StrictButton(
                 "Update DataValue Map",
                 css_class='btn btn-primary',
                 type='submit',
             ),
             crispy.HTML('<button type="button" '
                         '        class="btn btn-default" '
                         '        data-dismiss="modal">'
                         'Cancel'
                         '</button>'),
             css_class='modal-footer',
         )
     )
     return helper
コード例 #24
0
    def __init__(self, *args, **kwargs):
        photographer = kwargs.pop('photographer')
        assert isinstance(photographer, models.LuminaUser)
        assert photographer.is_photographer()

        super().__init__(*args, **kwargs)
        self.helper = helper.FormHelper()
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-lg-2'
        self.helper.field_class = 'col-lg-8'

        self.helper.layout = helper.Layout(
            layout.Fieldset(
                'Actualizar presupuesto', 'name', 'customer', 'image_quantity',
                forms_utils.DatePickerField('stipulated_date'),
                bootstrap.PrependedText('cost', '$'),
                bootstrap.PrependedText('stipulated_down_payment', '$'),
                'terms'),
            bootstrap.FormActions(
                layout.Submit('submit_update_quote',
                              'Actualizar',
                              css_id='form-submit-button'),
                layout.HTML(
                    '<a href="{% url "quote_detail" object.id %}" class="btn btn-primary">Volver</a>'
                )),
        )

        self.fields[
            'customer'].queryset = models.Customer.objects.customers_of(
                photographer)
コード例 #25
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.form_method = 'get'
        self.form_id = 'frmPersona'

        self.layout = layout.Layout(
            layout.Div(
                layout.Fieldset(
                    None,
                    layout.Div(
                        bootstrap.InlineField("nombre", wrapper_class="col-3"),
                        bootstrap.InlineField("apellido",
                                              wrapper_class="col-3"),
                        bootstrap.InlineField("documento",
                                              wrapper_class="col-3"),
                        bootstrap.InlineField("active", wrapper_class="col-3"),
                        css_class="row",
                    ),
                    css_class="col-10",
                ),
                bootstrap.FormActions(
                    layout.Button('btnFilter',
                                  'Buscar',
                                  css_id='btnFilter',
                                  css_class='btn btn-sm btn-primary',
                                  onclick='submit_modal(frmPersona);'),
                    css_class="col-2 text-right align-self-center",
                ),
                css_class="row",
            ))
コード例 #26
0
    def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)
        geoposition = self.instance.get_geoposition()
        if geoposition:
            self.fields["latitude"].initial = geoposition.latitude
            self.fields["longitude"].initial = geoposition.longitude

        name_field = layout.Field("name", css_class="input-block-level")
        description_field = layout.Field(
            "description", css_class="input-block-level", rows="3"
        )
        main_fieldset = layout.Fieldset(_("Main data"), name_field, description_field)

        picture_field = layout.Field(
            "picture",
            data_url=reverse("upload_file"),
            template="core/includes/file_upload_field.html",
        )
        picture_path_field = layout.Field("picture_path")

        picture_fieldset = layout.Fieldset(
            _("Picture"),
            picture_field,
            picture_path_field,
            title=_("Picture upload"),
            css_id="picture_fieldset",
        )

        street_address_field = layout.Field(
            "street_address", css_class="input-block-level"
        )
        street_address2_field = layout.Field(
            "street_address2", css_class="input-block-level"
        )
        postal_code_field = layout.Field("postal_code", css_class="input-block-level")
        city_field = layout.Field("city", css_class="input-block-level")
        country_field = layout.Field("country", css_class="input-block-level")
        latitude_field = layout.Field("latitude", css_class="input-block-level")
        longitude_field = layout.Field("longitude", css_class="input-block-level")
        address_fieldset = layout.Fieldset(
            _("Address"),
            street_address_field,
            street_address2_field,
            postal_code_field,
            city_field,
            country_field,
            latitude_field,
            longitude_field,
        )

        submit_button = layout.Submit("save", _("Save"))
        actions = bootstrap.FormActions(layout.Div(submit_button, css_class="col"))

        self.helper = helper.FormHelper()
        self.helper.form_action = self.request.path
        self.helper.form_method = "POST"
        self.helper.attrs = {"noValidate": "noValidate"}
        self.helper.layout = layout.Layout(main_fieldset, picture_fieldset, address_fieldset, actions)
コード例 #27
0
ファイル: forms.py プロジェクト: taba90/smb-portal
 def __init__(self, *args, **kwargs):
     self.user = kwargs.pop("user")
     is_ajax = kwargs.pop("is_ajax", None)
     action = kwargs.pop("action", None)
     submit_value = kwargs.pop("submit_value", "OK")
     super().__init__(*args, **kwargs)
     self.instance.owner = self.user
     self.helper = FormHelper()
     self.helper.form_id = "bikeForm"
     if action is not None:
         self.helper.form_action = action
     self.helper.layout = layout.Layout(
         layout.Field("nickname"),
         layout.Div(layout.Div(
             layout.Field("bike_type"),
             css_class="col-lg-4",
         ),
                    layout.Div(
                        layout.Field("gear"),
                        css_class="col-lg-4",
                    ),
                    layout.Div(
                        layout.Field("brake"),
                        css_class="col-lg-4",
                    ),
                    layout.Div(
                        layout.Field("brand"),
                        layout.Field("model"),
                        css_class="col-lg-6",
                    ),
                    layout.Div(
                        layout.Field("color"),
                        layout.Field("saddle"),
                        css_class="col-lg-6",
                    ),
                    layout.Div(
                        layout.Fieldset(
                            None,
                            "has_basket",
                            "has_cargo_rack",
                        ),
                        css_class="col-lg-6",
                    ),
                    layout.Div(
                        layout.Fieldset(
                            None,
                            "has_lights",
                            "has_bags",
                        ),
                        css_class="col-lg-6",
                    ),
                    css_class="row"),
         layout.Field("other_details"),
     )
     if not is_ajax:
         self.helper.layout.append(
             bootstrap.FormActions(layout.Submit("submit", submit_value)), )
コード例 #28
0
    def __init__(self, *args, **kwargs):
        super(SocialProfileUpdateForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.layout = layout.Layout(
            layout.Fieldset('', 'avatar', 'tagline', 'bio', 'location'),
            bootstrap.FormActions(
                layout.Submit('submit',
                              'Update profile',
                              css_class='btn btn-success'), ))
コード例 #29
0
ファイル: forms.py プロジェクト: rds0751/fec-cms
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.helper = FormHelper(self)
        self.helper.layout = layout.Layout(
            layout.Fieldset('', 'login', 'password'),
            bootstrap.FormActions(
                layout.Submit('submit', 'Log in',
                              css_class='btn btn-success'), ),
        )
コード例 #30
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.fields["bulletin_type"].widget = forms.RadioSelect()
        # delete empty choice for the type
        del self.fields["bulletin_type"].choices[0]

        title = layout.Field("title", css_class="input-block-level")
        desciption = layout.Field("description",
                                  css_class="input-block-level",
                                  rows="3")
        main_fieldset = layout.Fieldset(_("Main data"), "bulletin_type", title,
                                        desciption)

        image = layout.Field("image", css_class="input-block-level")
        format_html_template = """
            {% load i18n %}
            <p class="help-block">
            {% trans "Available formats are JPG, GIF, and PNG." %}
            {% trans "Minimal size is 800 × 800 px." %}
            </p>
            """
        format_html = layout.HTML(format_html_template)
        image_fieldset = layout.Fieldset(_("Image"),
                                         image,
                                         format_html,
                                         title=_("Image upload"),
                                         css_id="image_fieldset")

        contact_person = layout.Field("contact_person",
                                      css_class="input-block-level")
        phone_field = bootstrap.PrependedText(
            "phone",
            '<i class="ion-ios-telephone"></i>',
            css_class="input-block-level")
        email_field = bootstrap.PrependedText(
            "email",
            "@",
            css_class="input-block-level",
            placeholder="*****@*****.**")
        contact_info = layout.Div(phone_field,
                                  email_field,
                                  css_id="contact_info")
        contact_fieldset = layout.Fieldset(_("Contact"), contact_person,
                                           contact_info)

        submit_button = layout.Submit("submit", _("Save"))
        actions = bootstrap.FormActions(submit_button)

        self.helper = helper.FormHelper()
        self.helper.form_action = "bulletin-change"
        self.helper.form_method = "POST"
        self.helper.layout = layout.Layout(main_fieldset, image_fieldset,
                                           contact_fieldset, actions)