Пример #1
0
class CongregacionForm(ModelFormBase):
    class Meta:
        model = Congregacion
        exclude = ['edificacion']

    def __init__(self, *args, **kwargs):
        super(CongregacionForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.fields['fecha_fundacion'].widget = SelectDateWidget(
            years=(range(1900,
                         date.today().year + 1)))

        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-3'
        self.helper.field_class = 'col-sm-9'

        self.fields['titulos_obtenidos'].widget = forms.TextInput(
            attrs={'placeholder': 'Tecnico en Biblia, Master en Biblia'})

        self.helper.all().wrap(Field, css_class='input-sm')
        self.helper.filter_by_widget(forms.Textarea).wrap(
            Field, css_class="input-xlarge", rows="2")
        self.helper.filter_by_widget(SelectDateWidget).wrap(
            Field,
            css_class="input-sm",
            style="width:110px; float:left; margin-right:5px;")
        self.helper.filter_by_widget(forms.Select).wrap(InlineRadios)
Пример #2
0
class EdificacionForm(ModelFormBase):
    class Meta:
        model = Edificacion
        exclude = [
            'estado', 'usuario', 'etapa_actual', 'ingeniero', 'arquitecto',
            'tesorero', 'aprobacion_regional', 'aprobacion_arquitecto',
            'aprobacion_ingeniero', 'aprobacion_nacional',
            'aprobacion_tesorero', 'created', 'updated', 'requiere_arquitecto',
            'aprobacion_internacional', 'usuarios_asignados', 'planos_creados',
            'aprobacion_fotos', 'envio_icm', 'envio_alianza',
            'fecha_aprox_dedicacion'
        ]

    def __init__(self, *args, **kwargs):
        super(EdificacionForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.form_class = 'form-horizontal'
        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-3'
        self.helper.field_class = 'col-sm-9'
        self.fields['coordenadas'].widget = map_widgets.MapsGeoPointhWidget()

        #Esta es una manera mas sencilla de agregar atributos a los campos
        self.helper.all().wrap(Field, css_class='input-sm')
        self.helper['direccion'].wrap(Field,
                                      css_class="input-xlarge",
                                      rows="2")
        self.helper['coordenadas'].wrap(Field, css_class="geolocation_field")
        self.helper.filter_by_widget(forms.Select).wrap(InlineRadios)
Пример #3
0
class OpenmrsInstanceForm(forms.Form):
    server_url = forms.URLField()
    username = forms.CharField()
    password = forms.CharField(widget=forms.PasswordInput)

    def __init__(self, *args, **kwargs):
        super(OpenmrsInstanceForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-sm-3 col-md-2'
        self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'
        self.helper.all().wrap_together(layout.Fieldset,
                                        'Edit Server Information')
        self.helper.layout.append(
            crispy.FormActions(
                StrictButton(
                    _("Update Server Info"),
                    type="submit",
                    css_class='btn-primary',
                )))

    def save(self, domain):
        save_openmrs_account(domain, self.cleaned_data['server_url'],
                             self.cleaned_data['username'],
                             self.cleaned_data['password'])
Пример #4
0
def quiz_form_helper(quiz, form_to_use=None, select_to_radio=False):
    if form_to_use:
        form = form_to_use
    else:
        form = make_quiz_form(quiz, select_to_radio)
    helper = FormHelper()
    helper.form_id = 'quiz-{}-form'.format(quiz.id)
    helper.form_class = 'form quiz_form quiz-{}'.format(quiz.id)
    helper.form_method = 'post'
    helper.html5_required = True
    helper.render_required_fields = True
    helper.layout = Layout(*form.base_fields.keys())
    if quiz.use_categories:
        #  use fieldsets to separate question categories
        categories = Category.objects.filter(question__quiz=quiz).distinct()
        quiz_cats = {'answer_{}'.format(x.id): x.category for x in quiz.get_questions()}
        layout_items = []
        for cat in categories:
            fieldset_items = [cat.title]
            for answer_field in form.base_fields.keys():
                if quiz_cats[answer_field] == cat:
                    fieldset_items.append(answer_field)
            layout_items.append(Fieldset(*fieldset_items))
        helper.layout = Layout(*layout_items)
    if select_to_radio or quiz.question_widget == quiz.RADIO_WIDGET:
        helper.all().wrap(Field, css_class="question-field",
                          template="answers/bootstrap3/multichoice_radio_field.html")
    else:
        helper.all().wrap(Field, css_class="question-field")
    helper.add_input(Submit('submit', _('Submit'), css_class='btn-success btn-block btn-lg'))
    return helper
Пример #5
0
    def test_wrap_all_fields(self):
        helper = FormHelper()
        layout = Layout("email", "password1", "password2")
        helper.layout = layout

        helper.all().wrap(Field, css_class="test-class")
        for field in layout.fields:
            self.assertTrue(isinstance(field, Field))
            self.assertEqual(field.attrs["class"], "test-class")

        self.assertEqual(layout[0][0], "email")
        self.assertEqual(layout[1][0], "password1")
        self.assertEqual(layout[2][0], "password2")
Пример #6
0
    def test_wrap_all_fields(self):
        helper = FormHelper()
        layout = Layout(
            'email',
            'password1',
            'password2',
        )
        helper.layout = layout

        helper.all().wrap(Field, css_class="test-class")
        for field in layout.fields:
            self.assertTrue(isinstance(field, Field))
            self.assertEqual(field.attrs['class'], "test-class")
Пример #7
0
def test_wrap_all_fields():
    helper = FormHelper()
    layout = Layout("email", "password1", "password2")
    helper.layout = layout

    helper.all().wrap(Field, css_class="test-class")
    for field in layout.fields:
        assert isinstance(field, Field)
        assert field.attrs["class"] == "test-class"

    assert layout[0][0] == "email"
    assert layout[1][0] == "password1"
    assert layout[2][0] == "password2"
Пример #8
0
    def test_wrap_all_fields(self):
        helper = FormHelper()
        layout = Layout(
            'email',
            'password1',
            'password2',
        )
        helper.layout = layout

        helper.all().wrap(Field, css_class="test-class")
        for field in layout.fields:
            self.assertTrue(isinstance(field, Field))
            self.assertEqual(field.attrs['class'], "test-class")
Пример #9
0
class ComunidadForm(ModelFormBase):
    class Meta:
        model = Comunidad
        exclude = ['edificacion']

    def __init__(self, *args, **kwargs):
        super(ComunidadForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-3'
        self.helper.field_class = 'col-sm-9'

        self.helper.all().wrap(Field, css_class='input-sm')
Пример #10
0
class ComunidadForm(ModelFormBase):
    
    class Meta:
        model = Comunidad
        exclude = ['edificacion']

    def __init__(self, *args, **kwargs):
        super(ComunidadForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        
        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-3'
        self.helper.field_class = 'col-sm-9'

        self.helper.all().wrap(Field, css_class='input-sm')
Пример #11
0
class InformacionFinancieraForm(ModelFormBase):
    class Meta:
        model = InformacionFinanciera
        exclude = ['edificacion']

    def __init__(self, *args, **kwargs):
        super(InformacionFinancieraForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-3'
        self.helper.field_class = 'col-sm-9'

        self.helper.all().wrap(Field, css_class='input-sm')
        self.helper.filter_by_widget(forms.Select).wrap(InlineRadios)
Пример #12
0
def test_wrap_all_fields():
    helper = FormHelper()
    layout = Layout(
        'email',
        'password1',
        'password2',
    )
    helper.layout = layout

    helper.all().wrap(Field, css_class="test-class")
    for field in layout.fields:
        assert isinstance(field, Field)
        assert field.attrs['class'] == "test-class"

    assert layout[0][0] == 'email'
    assert layout[1][0] == 'password1'
    assert layout[2][0] == 'password2'
Пример #13
0
class CondicionesForm(ModelFormBase):
    class Meta:
        model = Condiciones
        exclude = ['edificacion']

    def __init__(self, *args, **kwargs):
        super(CondicionesForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-4'
        self.helper.field_class = 'col-sm-8'

        self.helper.all().wrap(Field, css_class='input-sm')
        self.helper.filter_by_widget(forms.Select).wrap(InlineRadios)
        self.helper.filter_by_widget(forms.Textarea).wrap(
            Field, css_class="input-xlarge", rows="4")
Пример #14
0
class CondicionesForm(ModelFormBase):
    
    class Meta:
        model = Condiciones
        exclude = ['edificacion']

    def __init__(self, *args, **kwargs):
        super(CondicionesForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        
        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-4'
        self.helper.field_class = 'col-sm-8'

        self.helper.all().wrap(Field, css_class='input-sm')
        self.helper.filter_by_widget(forms.Select).wrap(InlineRadios)
        self.helper.filter_by_widget(forms.Textarea).wrap(Field, css_class="input-xlarge", rows="4") 
Пример #15
0
class InformacionFinancieraForm(ModelFormBase):
    
    class Meta:
        model = InformacionFinanciera
        exclude = ['edificacion']
                    

    def __init__(self, *args, **kwargs):
        super(InformacionFinancieraForm, self).__init__(*args, **kwargs)        
        self.helper = FormHelper(self)

        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-3'
        self.helper.field_class = 'col-sm-9'

        self.helper.all().wrap(Field, css_class='input-sm') 
        self.helper.filter_by_widget(forms.Select).wrap(InlineRadios)
Пример #16
0
class ItemOrderForm(forms.Form):
    def __init__(self, *args, **kwargs):

        if 'item' in kwargs:
            item = kwargs.pop('item')

            self.name = item.name
            self.desc = item.description
            self.id = item.id
            self.number = item.number
            if item.image:
                self.image = item.image.url

        super(ItemOrderForm, self).__init__(*args, **kwargs)

        attrib_set = item.attribute_set.all()

        for attrib in attrib_set:

            finalopts = []
            opt_set = attrib.option_set.all()

            for opt in opt_set:
                finalopts.append([str(opt.id), opt.name])

            fieldname = str('attrib_' + str(attrib.id) + '_')

            self.fields[fieldname] = forms.ChoiceField(choices=finalopts,
                                                       label=attrib.name)

        self.fields['qty'] = forms.IntegerField(label='Quantity',
                                                min_value=1,
                                                max_value=5000,
                                                required=True,
                                                initial=1)

        self.fields['thisitemid'] = forms.IntegerField(
            widget=forms.HiddenInput(), initial=self.id)

        self.helper = FormHelper(self)
        #self.helper.form_class = 'form-horizontal'
        self.helper.form_tag = False
        self.helper.all().wrap(Div, css_class="col-md-4")
        self.helper.all().wrap_together(Div, css_class="form-row")
Пример #17
0
class EnvioTccForm(ModelForm):
    fecha_entrega = forms.DateField(
        widget=forms.TextInput(attrs={'type': 'date'}), required=False)
    fecha_entrega_boom = forms.DateField(
        widget=forms.TextInput(attrs={'type': 'date'}), required=False)

    class Meta:
        model = EnvioTransportadoraTCC
        fields = ('fecha_entrega', 'fecha_entrega_boom', 'estado',
                  'observacion')

    def __init__(self, *args, **kwargs):
        super(EnvioTccForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id-envioTccForm'
        self.helper.form_method = "post"

        self.helper.form_class = 'form-inline'
        self.helper.layout = Layout(
            HTML('<h2>Seguimiento</h2>'),
            Div(
                Field('fecha_entrega'),
                Field('estado'),
            ),
        )

        boom = Div(HTML('<h2>Seguimiento Boom</h2>'),
                   Div(Field('fecha_entrega_boom'), ))
        if not self.instance.nro_tracking_boom:
            boom = Div(Div(Field('fecha_entrega_boom'), ),
                       style="display:none")

        observacion = Div(HTML('<h2>Observaciones</h2>'),
                          Div(Field('observacion')),
                          FormActions(Submit('guardar', 'Guardar')))

        self.helper.layout.fields.append(boom)

        self.helper.layout.fields.append(observacion)

        self.helper.all().wrap(Field, css_class="form-control")
Пример #18
0
class CongregacionForm(ModelFormBase):
    
    class Meta:
        model = Congregacion
        exclude = ['edificacion']

    def __init__(self, *args, **kwargs):
        super(CongregacionForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.fields['fecha_fundacion'].widget = SelectDateWidget(years=( range(1900, date.today().year + 1) ) )
       
        self.helper.form_tag = False
        self.helper.label_class = 'col-sm-3'
        self.helper.field_class = 'col-sm-9'

        self.fields['titulos_obtenidos'].widget = forms.TextInput(attrs={'placeholder': 'Tecnico en Biblia, Master en Biblia'})
      
        self.helper.all().wrap(Field, css_class='input-sm')
        self.helper.filter_by_widget(forms.Textarea).wrap(Field, css_class="input-xlarge", rows="2") 
        self.helper.filter_by_widget(SelectDateWidget).wrap(Field, css_class="input-sm", style="width:110px; float:left; margin-right:5px;") 
        self.helper.filter_by_widget(forms.Select).wrap(InlineRadios)
Пример #19
0
class CertificationForm(forms.ModelForm):

    class Meta:
        model = GeneralApplication
        fields = (
            'community_building',
            'risk_management',
            'wilderness_skills',
            'croo_training',
            'fa_cert', 'fa_other'
        )
        widgets = {
            'community_building': DateTimePicker(options=TIMEPICKER_OPTIONS),
            'risk_management': DateTimePicker(options=TIMEPICKER_OPTIONS),
            'wilderness_skills': DateTimePicker(options=TIMEPICKER_OPTIONS),
            'croo_training': DateTimePicker(options=TIMEPICKER_OPTIONS,)
        }

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        self.helper.all().wrap(Div, css_class='col-sm-3')
        self.helper.all().wrap(Row)
        self.helper.add_input(Submit('submit', 'Update'))
Пример #20
0
class EdificacionForm(ModelFormBase):  

    class Meta:
        model = Edificacion
        exclude = ['estado', 'usuario', 'etapa_actual', 'ingeniero', 'arquitecto', 'tesorero',
                    'aprobacion_regional', 'aprobacion_arquitecto', 
                    'aprobacion_ingeniero', 'aprobacion_nacional', 'aprobacion_tesorero', 'created', 'updated', 
                    'requiere_arquitecto','aprobacion_internacional', 'usuarios_asignados', 'planos_creados','aprobacion_fotos','envio_icm','envio_alianza','fecha_aprox_dedicacion']

    def __init__(self, *args, **kwargs):
        super(EdificacionForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        
        self.helper.form_class       = 'form-horizontal'
        self.helper.form_tag         = False
        self.helper.label_class      = 'col-sm-3'
        self.helper.field_class      = 'col-sm-9'
        self.fields['coordenadas'].widget = map_widgets.MapsGeoPointhWidget()
        
        #Esta es una manera mas sencilla de agregar atributos a los campos
        self.helper.all().wrap(Field, css_class='input-sm') 
        self.helper['direccion'].wrap(Field, css_class="input-xlarge", rows="2")
        self.helper['coordenadas'].wrap(Field, css_class="geolocation_field")
        self.helper.filter_by_widget(forms.Select).wrap(InlineRadios) 
Пример #21
0
class CotizacionForm(ModelForm):
    email = forms.EmailField(label="Correo Electrónico", required=False)
    nro_contacto = forms.CharField(label="Número de Contacto", required=False)
    nombres_contacto = forms.CharField(label="Nombres", required=False)
    apellidos_contacto = forms.CharField(label="Apellidos", required=False)
    contacto_nuevo = forms.BooleanField(label="Contacto nuevo", required=False)
    razon_social = forms.CharField(label="Razón Social", required=False)
    email_adicional = forms.EmailField(label="Email Adicional", required=False)
    observaciones = forms.Textarea()
    ciudad_despacho = forms.ModelChoiceField(
        queryset=Ciudad.objects.select_related('departamento', 'departamento__pais').all(),
        widget=autocomplete.ModelSelect2(url='geografia:ciudad-autocomplete'),
        required=False
    )
    cliente_biable = forms.ModelChoiceField(
        queryset=Cliente.objects.all(),
        widget=autocomplete.ModelSelect2(url='biable:cliente-autocomplete'),
        required=False,
        label='Cliente CGuno'
    )
    contacto = forms.ModelChoiceField(
        queryset=ContactoEmpresa.objects.all(),
        widget=autocomplete.ModelSelect2(url='contactos:contactos-autocomplete', forward=['cliente_biable']),
        required=False,
        label='Contacto'
    )

    id = forms.IntegerField(required=False, widget=forms.HiddenInput)

    def clean(self):
        cleaned_data = super(CotizacionForm, self).clean()
        razon_social = cleaned_data.get("razon_social")
        cliente_biable = cleaned_data.get("cliente_biable")
        ciudad_despacho = cleaned_data.get("ciudad_despacho")
        ciudad = cleaned_data.get("ciudad")

        contacto = cleaned_data.get("contacto")
        email = cleaned_data.get("email")
        nombres_contacto = cleaned_data.get("nombres_contacto")
        apellidos_contacto = cleaned_data.get("apellidos_contacto")
        nro_contacto = cleaned_data.get("nro_contacto")

        if (not razon_social and not cliente_biable):
            # Only do something if both fields are valid so far.
            raise forms.ValidationError(
                "Debe tener o razón social o un cliente CGuno."
                " No puede estar vacios los dos campos"
            )

        if (not ciudad_despacho and not ciudad):
            # Only do something if both fields are valid so far.
            raise forms.ValidationError(
                "Debe tener o ciudad alterna o ciudad."
                " No puede estar vacios los dos campos"
            )

        if (not contacto and (not email or not nombres_contacto or not apellidos_contacto or not nro_contacto)):
            # Only do something if both fields are valid so far.
            raise forms.ValidationError(
                "Debe tener información de un contacto."
            )

    class Meta:
        model = Cotizacion
        fields = [
            'id',
            'razon_social',
            'cliente_biable',
            'sucursal_sub_empresa',
            'cliente_nuevo',
            'pais',
            'ciudad',
            'otra_ciudad',
            'ciudad_despacho',
            'nombres_contacto',
            'apellidos_contacto',
            'nro_contacto',
            'email',
            'observaciones',
            'contacto',
            'contacto_nuevo',
            'email_adicional',
        ]

    def __init__(self, *args, **kwargs):
        super(CotizacionForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'id-cotizacionForm'
        self.helper.form_method = "post"
        self.helper.form_class = 'form-inline'
        self.helper.layout = Layout(
            Div(
                Field('id'),
                Field('razon_social'),
                Field('cliente_biable'),
            ),
            Div(
                Field('sucursal_sub_empresa'),
            ),
            Div(
                Field('cliente_nuevo')
            ),
            Div(
                Field('pais'),
                Field('ciudad'),
            ),
            Div(
                Field('ciudad_despacho'),
            ),
            Div(
                Field('otra_ciudad')
            ),
            Div(
                Field('contacto'),
            ),
            Div(
                Field('nombres_contacto'),
                Field('apellidos_contacto')
            ),
            Div(
                Field('nro_contacto'),
            ),
            PrependedText('email', '@', placeholder="Correo Electrónico"),
            PrependedText('email_adicional', '@', placeholder="Correo Electrónico Adicional"),
            Div(
                Field('contacto_nuevo'),
            ),
            HTML('<hr/>'),
            Field('observaciones'),
            HTML('<hr/>')

        )
        self.helper.all().wrap(Field, css_class="form-control")
Пример #22
0
class userInfoForm(ModelForm):
    source_email = forms.EmailField(max_length=75, required=True)
    phone = forms.CharField(max_length=50, required=True)
    org = forms.ChoiceField(choices=[
        ('None', '---------------------'),
        ('CENTCOM HQ', 'CENTCOM HQ'),
        ('AFCENT', 'AFCENT'),
        ('ARCENT', 'ARCENT'),
        ('MARCENT', 'MARCENT'),
        ('NAVCENT', 'NAVCENT'),
        ('SOCCENT', 'SOCCENT'),
        ('OTHER', 'OTHER - Describe')], required=True)
    other_org = forms.CharField(max_length=50, required=False)

    class Meta:
        model = User
        fields = ('name_first', 'name_last')

    def __init__(self, *args, **kwargs):
        networks = kwargs.pop('networks')
        user = kwargs.get('instance')
        email = Email.objects.get(email_id=user.source_email.email_id)

        super(userInfoForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.fields['name_first'].label = 'First Name'
        self.fields['name_last'].label = 'Last Name'
        self.fields['source_email'].initial = email.address
        self.fields['source_email'].label = NETWORK + ' Email'
        self.fields['phone'].initial = user.phone
        self.fields['org'].initial = user.org
        self.fields['org'].label = "Organization"
        self.fields['other_org'].initial = user.other_org
        self.fields['other_org'].label = "Other Organization"
        self.helper.layout.append(HTML(
            '<div style="width: 100%"><hr class="mt-2 mb-3" style="border-top-width: 3px; border-top-color: rgba(0, 0, 0, 0.2);"/><h3 class="mt-3">Destination Emails</h3><p class="mb-4">You can only submit transfer requests to networks you have a valid email for.</p></div>'))

        for network in networks:
            net = Network.objects.get(name=network)
            fieldName = net.name+' Email'
            self.fields[fieldName] = forms.EmailField(max_length=75, required=False)
            self.fields[fieldName].label = fieldName
            try:
                networkEmail = user.destination_emails.get(network__name=network)
                self.fields[fieldName].initial = networkEmail.address

            except Email.MultipleObjectsReturned:
                networkEmail = user.destination_emails.filter(network__name=network)
                self.fields[fieldName].initial = networkEmail[0].address

            except Email.DoesNotExist:
                pass
            self.helper.layout.append(fieldName)

        self.helper.all().wrap_together(Div, css_class="inline-fields")
        self.helper.layout.append(Submit('save', 'Save'))

    def validate_form(self, form):
        for network in Network.objects.filter(visible=True):
            if form.get(network.name+' Email') == form.get('source_email'):
                self.add_error(network.name+' Email', "Destination email cannot be the same as " + NETWORK + " email")

        if form.get('org') == "None":
            self.add_error('org', "Select an organization")

        if form.get('org') == "OTHER" and form.get('other_org') == "":
            self.add_error('other_org', "List your organization")
Пример #23
0
class InformeSemestralForm(forms.ModelForm):
    """Formulario para crear un comentario"""
    class Meta:
        model = InformeSemestral
        exclude = ['edificacion', 'fecha_elaboracion', 'informe']

    def __init__(self, *args, **kwargs):
        super(InformeSemestralForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)

        self.helper.form_show_labels = True
        self.helper.form_class = 'form-horizontal'
        self.helper.label_class = 'col-sm-4'
        self.helper.field_class = 'col-sm-8'
        self.helper.form_action = "."

        self.helper.all().wrap(Field, css_class='input-sm')
        self.helper.filter_by_widget(forms.Textarea).wrap(
            Field, css_class="input-xlarge", rows="3")

        self.helper.layout = Layout(
            MultiField(
                '<b>Plantación*</b>',
                Div(
                    HTML(
                        '<p class="help-block">Cuantos proyectos misioneros o igleisas hijas fueron plantadas en el ultimo semestre</p>'
                    ),
                    Field('plantacion_nombre_1',
                          css_class='input-sm',
                          placeholder="nombre"),
                    Field('plantacion_lugar_1',
                          css_class='input-sm',
                          placeholder="lugar"),
                    Field('plantacion_fecha_1',
                          css_class='input-sm',
                          placeholder="mes/año"),
                    css_class='informe-semestral-plantacion clearfix',
                ),
                Div(
                    Field('plantacion_nombre_2',
                          css_class='input-sm',
                          placeholder="nombre"),
                    Field('plantacion_lugar_2',
                          css_class='input-sm',
                          placeholder="lugar"),
                    Field('plantacion_fecha_2',
                          css_class='input-sm',
                          placeholder="mes/año"),
                    css_class='informe-semestral-plantacion clearfix',
                ),
                Div(
                    Field('plantacion_nombre_3',
                          css_class='input-sm',
                          placeholder="nombre"),
                    Field('plantacion_lugar_3',
                          css_class='input-sm',
                          placeholder="lugar"),
                    Field('plantacion_fecha_3',
                          css_class='input-sm',
                          placeholder="mes/año"),
                    css_class='informe-semestral-plantacion clearfix',
                )), Field('miembros_actuales'), Field('nuevos_miembros'),
            Field('conversiones'), Field('bautismos_nuevos'),
            Field('no_bautismos'), Field('asistencia_general'),
            Field('ofrendas'), Field('plantacion'), Field('grupos_vida'),
            Field('asistencia_grupos'), Field('peticiones_oracion'),
            Field('testimonios'), Field('ministerio_ninos'),
            Field('uso_local'), Field('fotos'),
            FormActions(
                StrictButton('Enviar Informe',
                             type="Submit",
                             css_class="btn btn-success pull-right btn-md",
                             autocomplete="off"), ))
Пример #24
0
class InformeSemestralForm(forms.ModelForm):
    """Formulario para crear un comentario"""

    class Meta:
        model = InformeSemestral
        exclude = ['edificacion','fecha_elaboracion','informe']

    def __init__(self, *args, **kwargs):
        super(InformeSemestralForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper(self)
        
        self.helper.form_show_labels = True
        self.helper.form_class       = 'form-horizontal'
        self.helper.label_class = 'col-sm-4'
        self.helper.field_class = 'col-sm-8'
        self.helper.form_action = "."

        self.helper.all().wrap(Field, css_class='input-sm')       
        self.helper.filter_by_widget(forms.Textarea).wrap(Field, css_class="input-xlarge", rows="3")

        self.helper.layout = Layout(  
            
            MultiField(
                '<b>Plantación*</b>', 
                Div(
                    HTML('<p class="help-block">Cuantos proyectos misioneros o igleisas hijas fueron plantadas en el ultimo semestre</p>'),
                    Field('plantacion_nombre_1', css_class='input-sm', placeholder="nombre"),  
                    Field('plantacion_lugar_1', css_class='input-sm', placeholder="lugar"),
                    Field('plantacion_fecha_1', css_class='input-sm', placeholder="mes/año"),
                    css_class = 'informe-semestral-plantacion clearfix',
                ),
                Div(
                    Field('plantacion_nombre_2', css_class='input-sm', placeholder="nombre"),  
                    Field('plantacion_lugar_2', css_class='input-sm', placeholder="lugar"),
                    Field('plantacion_fecha_2', css_class='input-sm', placeholder="mes/año"),
                    css_class = 'informe-semestral-plantacion clearfix',
                ),
                Div(
                    Field('plantacion_nombre_3', css_class='input-sm', placeholder="nombre"),  
                    Field('plantacion_lugar_3', css_class='input-sm', placeholder="lugar"),
                    Field('plantacion_fecha_3', css_class='input-sm', placeholder="mes/año"),
                    css_class = 'informe-semestral-plantacion clearfix',
                )
            ),

            Field('miembros_actuales'),
            Field('nuevos_miembros'),
            Field('conversiones'),
            Field('bautismos_nuevos'),
            Field('no_bautismos'),
            Field('asistencia_general'),
            Field('ofrendas'),
            Field('plantacion'),
            Field('grupos_vida'), 
            Field('asistencia_grupos'),
            Field('peticiones_oracion'),
            Field('testimonios'),
            Field('ministerio_ninos'),
            Field('uso_local'),
            Field('fotos'),
            FormActions(      
                
                StrictButton('Enviar Informe', type="Submit", css_class="btn btn-success pull-right btn-md", autocomplete="off"),
            )
        )