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)
Example #2
0
 def __init__(self, *args, **kwargs):
     super(UpdateNameForm, self).__init__(*args, **kwargs)
     self.helper = helper.FormHelper(self)
     self.helper.form_show_labels = False
     self.helper.form_tag = False
     self.helper.layout = layout.Layout(
         layout.Div(
             layout.Div(
                 layout.Div(
                     layout.HTML(
                         fieldtostring(True,
                                       "required",
                                       "autofocus",
                                       type="text",
                                       name="first_name",
                                       value="",
                                       css_class="form-control")),
                     layout.HTML(valuetolabel("first_name", "First Name")),
                     css_class="md-form",
                 ), ),
             layout.Div(
                 layout.Div(
                     layout.HTML(
                         fieldtostring(True,
                                       "required",
                                       type="text",
                                       name="last_name",
                                       value="",
                                       css_class="form-control")),
                     layout.HTML(valuetolabel("last_name", "Last Name")),
                     css_class="md-form",
                 ), ),
         ))
Example #3
0
 def __init__(self, *args, **kwargs):
     super(UpdateBirthdayForm, self).__init__(*args, **kwargs)
     self.helper = helper.FormHelper(self)
     self.helper.form_show_labels = False
     self.helper.form_tag = False
     self.helper.layout = layout.Layout(
         layout.Div(layout.Layout('birthday')))
Example #4
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # # valores iniciales para campos especiales
        # self.fields['comunicaciones'].widget.attrs['size'] = 13
        # self.fields['comunicaciones'].help_text = "Pulse Ctrl para seleccionar varios"

        # self.fields['domicilios'].widget.attrs['size'] = 13
        # self.fields['domicilios'].help_text = "Pulse Ctrl para seleccionar varios"

        # creamos helper
        self.helper = helper.FormHelper()
        self.helper.form_id = "myform"

        # creamos layouts
        self.helper.layout = layout.Layout()

        # agregamos todos los campos
        for fld in self.Meta.fields:
            self.helper.layout.append(fld)

        # agregamos los botones de acción
        bSave = '<button type="submit" class="btn btn-sm btn-primary btn-icon-split mr-1"><span class="icon text-white-50"><i class="fas fa-save"></i></span><span class="text">Grabar</span></button>'
        bCancel = '<a class="btn btn-sm btn-warning btn-icon-split" href="{{request.META.HTTP_REFERER}}"><span class="icon text-white-50"><i class="fas fa-undo"></i></span><span class="text text-dark">Cancela</span></a>'
        self.helper.layout.append(layout.HTML("<hr>"))
        self.helper.layout.append(layout.HTML(bSave))
        self.helper.layout.append(layout.HTML(bCancel))
Example #5
0
    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)
Example #6
0
    def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)
        self.fields['date_of_reburial'].label = "Дата"
        self.fields['reburial_cause'].label = "Причина"
        self.fields['address'].label = "Адрес"
        self.fields['cemetery_item'].label = "Кладбище"

        date_of_reburial_field = layout.Field(
            "date_of_reburial", css_class="input-block-level date")

        reburial_cause_field = layout.Field("reburial_cause",
                                            css_class="input-block-level")

        address_field = layout.Field(
            "address",
            css_class=
            "btn btn-outline-secondary input-block-level hidden-select-address"
        )

        cemetery_item_field = layout.Field(
            "cemetery_item",
            css_class=
            "btn btn-outline-secondary input-block-level hidden-select-cemetery"
        )

        self.helper = helper.FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.layout = layout.Layout(date_of_reburial_field,
                                           reburial_cause_field, address_field,
                                           cemetery_item_field)
Example #7
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # valores iniciales para campos especiales
        self.fields['comercial'].queryset = Comercial.objects.all().order_by('persona__nombre')
        self.fields['actividad'].queryset = Actividad.objects.filter(parent__isnull=True).order_by('nombre')

        # creamos helper
        self.helper = helper.FormHelper()
        self.helper.form_id = "myform"

        # creamos layouts personalizado
        self.helper.layout = layout.Layout(
            layout.Row(
                layout.Column('nombre', css_class='col-lg-6 col-md-12 mb-0'),
                layout.Column('razon_social'),
            ),
            layout.Row(
                layout.Column('cuit', css_class='col-lg-3 col-md-3 col-sm-6 mb-0'),
                layout.Column('comercial'),
                layout.Column('referencia_id', css_class='col-lg-3 col-md-3 col-sm-3 mb-0'),
            ),
            layout.Row(
                layout.Column('actividad', css_class='col-lg-6 col-md-12 mb-0'),
                layout.Column('actividades'),
            ),
            'observacion',
        )

        # agregamos los botones de acción
        bSave = '<button type="submit" class="btn btn-primary btn-icon-split"><span class="icon text-white-50"><i class="fas fa-save"></i></span><span class="text">Grabar</span></button>'
        bCancel = '<a class="btn btn-warning btn-icon-split" style="margin-left: 5px" href="{{request.META.HTTP_REFERER}}"><span class="icon text-white-50"><i class="fas fa-undo"></i></span><span class="text">Cancela</span></a>'
        self.helper.layout.append(layout.HTML("<hr>"))
        self.helper.layout.append(layout.HTML(bSave))
        self.helper.layout.append(layout.HTML(bCancel))
Example #8
0
    def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)
        self.fields['period_from'].label = "C"
        self.fields['period_to'].label = "По"
        self.fields['camp'].label = "Название лагеря"
        self.fields['number'].label = "Номер военнопленного"
        id_field = layout.Field("id")

        period_from_field = layout.Field("period_from",
                                         css_class="input-block-level date")

        period_to_field = layout.Field("period_to",
                                       css_class="input-block-level date")

        camp_field = layout.Field("camp", css_class="input-block-level camp")

        number_field = layout.Field("number",
                                    css_class="input-block-level test")

        delete_field = layout.Field("DELETE", css_class="input-block-level")

        self.helper = helper.FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.layout = layout.Layout(id_field, period_from_field,
                                           period_to_field, camp_field,
                                           number_field, delete_field)
Example #9
0
    def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)
        self.fields['period_from'].label = "C"
        self.fields['period_to'].label = "По"
        self.fields['labour_team'].label = "Рабочая команда"
        id_field = layout.Field("id")

        period_from_field = layout.Field("period_from",
                                         css_class="input-block-level date")

        period_to_field = layout.Field("period_to",
                                       css_class="input-block-level date")

        labour_team_field = layout.Field(
            "labour_team", css_class="input-block-level labour-team")

        delete_field = layout.Field("DELETE", css_class="input-block-level")

        self.helper = helper.FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.layout = layout.Layout(id_field, period_from_field,
                                           period_to_field, labour_team_field,
                                           delete_field)
Example #10
0
    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)
Example #11
0
 def __init__(self, *args, **kwargs):
     photographer = kwargs.pop('photographer')
     assert isinstance(photographer, models.LuminaUser)
     assert photographer.is_photographer()
     # We don't really use `photographer`, but we receive it, so, we make sure it's a photographer
     super().__init__(*args, **kwargs)
     self.helper = helper.FormHelper()
Example #12
0
 def get_helper(self):
     h = helper.FormHelper()
     h.layout = layout.Layout(*self.get_layout())
     if hasattr(self, 'inline') and self.inline:
         h.field_template = 'bootstrap3/layout/inline_field.html'
         h.form_class = 'form-inline'
     return h
Example #13
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # valores iniciales para campos especiales
        self.fields['comercial'].queryset = Comercial.objects.all().order_by(
            'persona__nombre')
        self.fields['actividad'].queryset = Actividad.objects.filter(
            parent__isnull=True).order_by('nombre')
        self.fields['actividades'].queryset = Actividad.objects.filter(
            parent__isnull=False).order_by('nombre')

        # self.fields['comercial'].queryset = None
        # self.fields['actividad'].queryset = None
        # self.fields['actividades'].queryset = None

        self.fields['actividades'].widget.attrs['size'] = 13
        self.fields[
            'actividades'].help_text = "Pulse Ctrl para seleccionar varios"

        # creamos helper
        self.helper = helper.FormHelper()
        self.helper.form_id = "myform"

        # creamos layouts personalizado
        self.helper.layout = layout.Layout(
            layout.Row(
                layout.Column('nombre', css_class='col-lg-5 col-md-4 mb-0'),
                layout.Column('razon_social',
                              css_class='col-lg-5 col-md-4 mb-0'),
                layout.Column('cuit',
                              css_class='col-lg-2 col-md-4 mb-0',
                              onkeypress="buscar_cliente(event)"),
            ),
            layout.Row(
                layout.Column('actividad', css_class='col-lg-4 col-md-4 mb-0'),
                layout.Column('comercial', css_class='col-lg-3 col-md-4 mb-0'),
                layout.Column('calificacion',
                              css_class='col-lg-3 col-md-4 mb-0'),
                layout.Column('referencia_id',
                              css_class='col-lg-2 col-md-12 mb-0'),
            ),
            layout.Row(
                layout.Column('actividades',
                              css_class='col-lg-5 col-md-6 mb-0'),
                layout.Column('observacion',
                              css_class='col-lg-7 col-md-6 mb-0'),
            ),
            'active',
        )

        # self.helper.layout = layout.Layout(
        #     layout.Field('cuit', onkeypress="buscar_cliente(event)")
        # )

        # agregamos los botones de acción
        bSave = '<button type="submit" class="btn btn-sm btn-primary btn-icon-split mr-1"><span class="icon text-white-50"><i class="fas fa-save"></i></span><span class="text">Grabar</span></button>'
        bCancel = '<a class="btn btn-sm btn-warning btn-icon-split" href="{{request.META.HTTP_REFERER}}"><span class="icon text-white-50"><i class="fas fa-undo"></i></span><span class="text text-dark">Cancela</span></a>'
        self.helper.layout.append(layout.HTML("<hr>"))
        self.helper.layout.append(layout.HTML(bSave))
        self.helper.layout.append(layout.HTML(bCancel))
Example #14
0
 def __init__(self, *args, **kwargs):
     super(UpdateGenderForm, self).__init__(*args, **kwargs)
     self.helper = helper.FormHelper(self)
     self.helper.form_show_labels = False
     self.helper.form_tag = False
     self.helper.layout = layout.Layout(
         layout.Div(bootstrap.InlineRadios('gender')))
Example #15
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.fields['notes'].widget.attrs['rows'] = 5

        self.helper = helper.FormHelper(self)
        self.helper.form_tag = False
Example #16
0
    def __init__(self, user, *args, **kwargs):
        super(WizardBasicInfoForm, self).__init__(*args, **kwargs)
        self.fields['run_date'].required = True

        self.fields['milestones'] = forms.MultipleChoiceField(
            required=False,
            choices=[('{} - {}'.format(i.project.name,
                                       i.name), [(m.id, m.name)
                                                 for m in i.milestones.all()])
                     for i in user.get_investigations('member')
                     if i.milestones.exists()])
        self.fields['investigations'] = forms.MultipleChoiceField(
            required=False,
            choices=[(p.name, [(i.id, i.name) for i in p.investigations.all()])
                     for p in user.get_projects('member')
                     if p.investigations.exists()])
        self.fields['type'].queryset = ProcessType.objects.exclude(
            creation_type='custom')
        self.helper = helper.FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.label_class = 'col-md-2'
        self.helper.field_class = 'col-md-10'
        self.helper.layout = layout.Layout(
            layout.Field('user'),
            layout.Field('type'),
            layout.Field('run_date'),
            layout.Field('title'),
            layout.Field('comment', css_class='hallo'),
            layout.Field('investigations'),
            layout.Field('milestones'),
        )
Example #17
0
    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),
        )
Example #18
0
    def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)

        id_field = layout.Field("id")
        language_field = layout.Field("language",
                                      css_class="input-block-level")
        title_field = layout.Field("title", css_class="input-block-level")
        content_field = layout.Field("content",
                                     css_class="input-block-level",
                                     rows="3")
        delete_field = layout.Field("DELETE")
        main_fieldset = layout.Fieldset(
            _("Main data"),
            id_field,
            language_field,
            title_field,
            content_field,
            delete_field,
        )

        self.helper = helper.FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.layout = layout.Layout(main_fieldset)
Example #19
0
    def __init__(self, user, *args, **kwargs):
        super(WizardBasicProcessForm, self).__init__(*args, **kwargs)
        self.fields['run_date'].required = True

        self.fields['milestones'] = forms.MultipleChoiceField(
            required=False,
            choices=[('{} - {}'.format(i.project.name,
                                       i.name), [(m.id, m.name)
                                                 for m in i.milestones.all()])
                     for i in user.get_investigations('member')
                     if i.milestones.exists()])
        self.fields['investigations'] = forms.MultipleChoiceField(
            required=False,
            choices=[(p.name, [(i.id, i.name) for i in p.investigations.all()])
                     for p in user.get_projects('member')
                     if p.investigations.exists()])

        self.helper = helper.FormHelper()
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.label_class = 'col-md-2'
        self.helper.field_class = 'col-md-6'
        self.helper.layout = layout.Layout(
            layout.Field('user'),
            layout.Field('type'),
            layout.Field('run_date'),
            layout.Field('legacy_identifier'),
            layout.Field('investigations'),
            layout.Field('milestones'),
        )
Example #20
0
    def __init__(self, *args, **kwargs):
        self.user = kwargs['existing_user']
        api_key = kwargs.pop('api_key') if 'api_key' in kwargs else None
        super(UpdateMyAccountInfoForm, self).__init__(*args, **kwargs)
        self.username = self.user.username

        username_controls = []
        if self.username:
            username_controls.append(
                hqcrispy.StaticField(ugettext_lazy('Username'), self.username))

        api_key_controls = [
            hqcrispy.StaticField(ugettext_lazy('API Key'), api_key),
            hqcrispy.FormActions(twbscrispy.StrictButton(
                ugettext_lazy('Generate API Key'),
                type="button",
                id='generate-api-key',
                css_class='btn-default',
            ),
                                 css_class="form-group"),
        ]

        self.fields['language'].label = ugettext_lazy("My Language")

        self.new_helper = cb3_helper.FormHelper()
        self.new_helper.form_method = 'POST'
        self.new_helper.form_class = 'form-horizontal'
        self.new_helper.attrs = {
            'name': 'user_information',
        }
        self.new_helper.label_class = 'col-sm-3 col-md-2 col-lg-2'
        self.new_helper.field_class = 'col-sm-9 col-md-8 col-lg-6'

        basic_fields = [
            cb3_layout.Div(*username_controls),
            hqcrispy.Field('first_name'),
            hqcrispy.Field('last_name'),
            hqcrispy.Field('email'),
        ]
        if self.set_analytics_enabled:
            basic_fields.append(
                twbscrispy.PrependedText('analytics_enabled', ''), )
        if self.set_email_opt_out:
            basic_fields.append(twbscrispy.PrependedText('email_opt_out', ''))

        self.new_helper.layout = cb3_layout.Layout(
            cb3_layout.Fieldset(ugettext_lazy("Basic"), *basic_fields),
            (hqcrispy.FieldsetAccordionGroup
             if self.collapse_other_options else cb3_layout.Fieldset)(
                 ugettext_lazy("Other Options"),
                 hqcrispy.Field('language'),
                 cb3_layout.Div(*api_key_controls),
             ),
            hqcrispy.FormActions(
                twbscrispy.StrictButton(
                    ugettext_lazy("Update My Information"),
                    type='submit',
                    css_class='btn-primary',
                )))
    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)
Example #22
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = helper.FormHelper()
     self.helper.form_show_labels = False
     self.helper.layout = layout.Layout(
             layout.Field('text', rows=3, **{
                 'data-component': 'keysubmit autosize cite cite-sink'
             }))
Example #23
0
    def __init__(self, *args, **kwargs):
        super(DomicilioForm, self).__init__(*args, **kwargs)

        # # dropdown
        # if self.instance.provincia_id:
        #     self.fields['departamento'].queryset = (Departamento.objects.filter(provincia_id=self.instance.provincia_id))
        # if self.instance.departamento_id:
        #     self.fields['localidad'].queryset = (Localidad.objects.filter(departamento_id=self.instance.departamento_id))

        # creamos helper
        self.helper = helper.FormHelper()
        self.helper.form_id = "myform"

        # # creamos layouts
        # self.helper.layout = layout.Layout()

        # # agregamos todos los campos
        # for fld in self.Meta.fields:
        #     self.helper.layout.append(fld)

        campo = '<div class="formColumn col-lg-1 col-md-2 col-sm-6 mb-0"><div id="div_id_hectarea" class="form-group" style="display: none"><label for="id_hectarea" class="col-form-label">Hectareas</label><div class=""><input type="text" name="hectarea" maxlength="2" class="textinput textInput form-control" id="id_hectarea"></div></div></div>'

        # creamos layouts personalizado
        self.helper.layout = layout.Layout(
            layout.Row(
                layout.Column('tipo', css_class='col-lg-4 col-md-6 mb-0'),
                layout.HTML(campo),
            ),
            layout.Row(
                layout.Column('tipo_calle', css_class='col-lg-3 col-md-6 mb-0'),
                layout.Column('nombre',     css_class='col-lg-6 col-md-9 mb-0'),
                layout.Column('numero',     css_class='col-lg-3 col-md-3 mb-0'),
            ),
            layout.Row(
                layout.Column('piso',   css_class='col-lg-4 col-md-4 col-sm-6 mb-0'),
                layout.Column('puerta', css_class='col-lg-4 col-md-4 col-sm-6 mb-0'),
                layout.Column('barrio', css_class='col-lg-4 col-md-4 col-sm-12 mb-0'),
            ),
            layout.Row(                
                layout.Column('provincia',    css_class='col-lg-4 col-md-6  col-sm-12 mb-0'),
                layout.Column('departamento', css_class='col-lg-4 col-md-6  col-sm-12 mb-0'),
                layout.Column('localidad',    css_class='col-lg-4 col-md-12 col-sm-12 mb-0'),
            ),
            layout.Row(                
                layout.Column(layout.Field('provincia_texto',    readonly=True), css_class='col-lg-4 col-md-12 col-sm-12 mb-0'),
                layout.Column(layout.Field('departamento_texto', readonly=True), css_class='col-lg-4 col-md-12 col-sm-12 mb-0'),
                layout.Column(layout.Field('localidad_texto',    readonly=True), css_class='col-lg-4 col-md-12 col-sm-12 mb-0'),
            ),
            'observacion_texto',
            'active',
        )

        # agregamos los botones de acción
        bSave = '<button type="submit" class="btn btn-sm btn-primary btn-icon-split mr-1"><span class="icon text-white-50"><i class="fas fa-save"></i></span><span class="text">Grabar</span></button>'
        bCancel = '<a class="btn btn-sm btn-warning btn-icon-split" href="{{request.META.HTTP_REFERER}}"><span class="icon text-white-50"><i class="fas fa-undo"></i></span><span class="text text-dark">Cancela</span></a>'
        self.helper.layout.append(layout.HTML("<hr>"))
        self.helper.layout.append(layout.HTML(bSave))
        self.helper.layout.append(layout.HTML(bCancel))
 def __init__(self, *args, action='', **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = helper.FormHelper()
     self.helper.form_class = 'form-horizontal'
     self.helper.label_class = 'col-md-6'
     self.helper.field_class = 'col-md-6'
     self.helper.form_method = 'post'
     self.helper.form_action = action
     self.helper.add_input(layout.Submit('submit', 'Start new game'))
Example #25
0
 def __init__(self, **kwargs):
     action = kwargs.pop('action')
     data_fields = kwargs.pop('data_fields')
     description = kwargs.pop('description')
     super().__init__(**kwargs)
     self.data_fields = data_fields
     self.fields.update(self.get_form_fields())
     self.helper = helper.FormHelper()
     self.helper.layout = self.get_layout(
             action=action, description=description)
Example #26
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = cfh.FormHelper()
     self.helper.form_id = 'SearchByRoomForm'
     self.helper.form_method = 'post'
     self.helper.add_input(cfl.Submit('submit_room', '1. Räume finden'))
     self.helper.add_input(
         cfl.Submit('submit_visitgroup', '2. Kontaktgruppen finden'))
     self.helper.add_input(
         cfl.Submit('submit_xlsx', '3. Kontaktgruppen-Excel herunterladen'))
Example #27
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)
Example #28
0
    def __init__(self, request, *args, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)

        self.helper = helper.FormHelper()
        self.helper.form_action = self.request.path
        self.helper.form_method = "GET"
        self.helper.layout = layout.Layout(
            layout.Field("q", css_class="input-block-level"),
            layout.Submit("search", _("Search")),
        )
Example #29
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.helper = helper.FormHelper()
     self.helper.add_input(layout.Submit('submit', 'Save'))
     self.helper.add_input(
         layout.Button(
             'cancel', 'Cancel',
             css_class='btn-danger',
             onclick="window.location.href = '/';"
         )
     )
Example #30
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.fields['reminder_search'].widget.attrs.update({'autofocus': True})

        self.fields['result'].label += ':'

        self.helper = helper.FormHelper(self)
        self.helper.form_tag = False
        self.helper.disable_csrf = True
        self.helper.field_template = 'bootstrap3/layout/inline_field.html'