Exemple #1
0
    def __init__(self, *args, **kwargs):
        super(PedidoForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.layout = Layout(
            Row(
                Div(Field('address', css_class='input-required'),
                    css_class='col-md-4'),
                Div(Field('parent', ), css_class='col-md-4'),
                Div(Field('permission', ), css_class='col-md-4'),
            ),
            Row(
                Div(Field('pos',
                          css_class='input-required input-integer mask-pint'),
                    css_class='col-md-4'),
                Div(Field('icon', ), css_class='col-md-4'),
                Div(Field('url', css_class='input-required'),
                    css_class='col-md-4'),
            ),
            Row(FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ), ),
        )
Exemple #2
0
    def __init__(self, *args, **kwargs):
        super(PostForm, self).__init__(*args, **kwargs)

        self.fields[
            'title'].help_text = u'<small class="help-error"></small> %s' % (
                u' ')
        self.fields[
            'body'].help_text = u'<small class="help-error"></small> %s' % (
                u' ')

        self.fields['body'].widget.attrs = {
            'rows': 3,
        }
        self.fields['body'].label = 'Cuerpo'

        self.helper = FormHelper()
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.form_id = 'form'

        self.helper.layout = Layout(
            Row(
                Div(Field('title', css_class='input-required'),
                    css_class='col-md-6'),
                Div(Field('body', css_class="input-required"),
                    css_class='col-md-6'),
            ),
            Row(
                Div(Field('asd', css_class='input-required'),
                    css_class='col-md-6'), ),
            Row(FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ), ),
        )
Exemple #3
0
    def __init__(self, *args, **kwargs):
        super(MenuForm, self).__init__(*args, **kwargs)
        self.fields[
            'title'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')
        self.fields[
            'pos'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')
        self.fields[
            'url'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')
        '''
        self.fields['permission'] = MyModelChoiceField(
            label=capfirst(_(u'permission')), required=False,

            queryset=Permission.objects.all(),

            # queryset=list(
            #    c['content_type__app_label'] for c in Permission.objects.all()
            #),
            # widget=forms.CheckboxSelectMultiple(),
            # widget=forms.SelectMultiple(attrs={'class':'form-control'}),
            help_text=u'<small class="help-error"></small> %s' % _(
                u' '),
        )
        '''
        self.fields['parent'].queryset = Menu.objects.filter(parent=None)

        self.fields['permission'].label_from_instance = lambda obj: "%s/%s" % (
            obj.content_type.app_label, obj.codename)

        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.layout = Layout(
            Row(
                Div(Field('title', css_class='input-required'),
                    css_class='col-md-4'),
                Div(Field('parent', ), css_class='col-md-4'),
                Div(Field('permission', ), css_class='col-md-4'),
            ),
            Row(
                Div(Field('pos',
                          css_class='input-required input-integer mask-pint'),
                    css_class='col-md-4'),
                Div(Field('icon', ), css_class='col-md-4'),
                Div(Field('url', css_class='input-required'),
                    css_class='col-md-4'),
            ),
            Row(FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ), ),
        )
Exemple #4
0
    def __init__(self, *args, **kwargs):
        super(PermissionForm, self).__init__(*args, **kwargs)
        self.fields['name'] = forms.CharField(
            label=capfirst(_(u'name')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' %
            _(u'Can CRUD to Model'),
        )
        self.fields['app_label'] = forms.CharField(
            label=_(u'App'),
            required=True,
            help_text=u'<small class="help-error"></small> %s' %
            _(u'Ingrese palabra de la forma [A-Z0-9_]'),
        )

        self.fields['controller_view'] = forms.CharField(
            label=_(u'Controller'),
            required=False,
            help_text=u'<small class="help-error"></small> %s' %
            _(u'Ingrese palabra de la forma [A-Z0-9]'),
        )
        self.fields['action_view'] = forms.CharField(
            label=_(u'Action'),
            required=False,
            help_text=u'<small class="help-error"></small> %s' %
            _(u'Ingrese palabra de la forma [A-Z0-9_]'),
        )

        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.layout = Layout(
            Row(
                Div(Field('app_label', css_class='input-required input-word_'),
                    css_class='col-md-4'),
                Div(Field('controller_view', css_class='input-word'),
                    css_class='col-md-4'),
                Div(Field('action_view', css_class='input-word_'),
                    css_class='col-md-4'),
            ),
            Row(
                Div(Field('name', css_class='input-required'),
                    css_class='col-md-8'),  # input-alphanum
            ),
            Row(FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ), ),
        )
Exemple #5
0
    def __init__(self, *args, **kwargs):
        super(GroupForm, self).__init__(*args, **kwargs)

        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.layout = Layout(
            Row(
                Div(Field('name', css_class='input-required'),
                    css_class='col-md-12')),
            Row(FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ), ),
        )
Exemple #6
0
    def __init__(self, *args, **kwargs):
        super(MenuForm, self).__init__(*args, **kwargs)
        self.fields[
            'title'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')
        self.fields[
            'pos'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')
        self.fields[
            'url'].help_text = u'<small class="help-error"></small> %s' % _(
                u' ')
        self.fields['parent'].queryset = Menu.objects.filter(parent=None)

        self.fields['permission'].label_from_instance = lambda obj: "%s/%s" % (
            obj.content_type.app_label, obj.codename)

        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.layout = Layout(
            Row(
                Div(Field('title', css_class='input-required'),
                    css_class='col-md-4'),
                Div(Field('parent', ), css_class='col-md-4'),
                Div(Field('permission', ), css_class='col-md-4'),
            ),
            Row(
                Div(Field('pos',
                          css_class='input-required input-integer mask-pint'),
                    css_class='col-md-4'),
                Div(Field('icon', ), css_class='col-md-4'),
                Div(Field('url', css_class='input-required'),
                    css_class='col-md-4'),
            ),
            Row(FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ), ),
        )
Exemple #7
0
 def __init__(self, *args, **kwargs):
     super(ProductoForm, self).__init__(*args, **kwargs)
     self.fields['descripcion'].widget.attrs['rows'] = 3
     self.helper = FormHelper()
     self.helper.attrs['autocomplete'] = "off"
     self.helper.form_method = 'post'
     self.helper.form_class = 'js-validate form-vertical'
     self.helper.layout = Layout(
         Row(
             Div(Field('producto_general', css_class='input-required'),
                 css_class='col-md-2'),
             Div(Field('color', css_class='form_control'),
                 css_class='col-md-2'),
             Div(Field('codigo', css_class='input-required'),
                 css_class='col-md-2'),
         ),
         Row(FormActions(
             smtSave(),
             btnCancel(),
             btnReset(),
         ), ),
     )
Exemple #8
0
    def __init__(self, *args, **kwargs):
        super(IngredienteForm, self).__init__(*args, **kwargs)

        self.fields[
            'producto'].help_text = u'<small class="help-error"></small> %s' % (
                u' ')
        self.fields[
            'cantidad'].help_text = u'<small class="help-error"></small> %s' % (
                u' ')

        self.helper = FormHelper()
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.form_id = 'form'

        self.helper.layout = Layout(
            Field('producto', css_class='input-required'),
            Field('cantidad', css_class='input-required'),
            FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ),
        )
Exemple #9
0
    def __init__(self, *args, **kwargs):
        super(RecetaForm, self).__init__(*args, **kwargs)

        self.fields[
            'nombre'].help_text = u'<small class="help-error"></small> %s' % (
                u' ')
        self.fields[
            'porcion'].help_text = u'<small class="help-error"></small> %s' % (
                u' ')
        self.fields[
            'tipo_receta'].help_text = u'<small class="help-error"></small> %s' % (
                u' ')
        self.fields[
            'descripcion'].help_text = u'<small class="help-error"></small> %s' % (
                u' ')
        self.fields['nombre'].widget.attrs = {
            'placeholder': 'Ingrese nombre de la receta'
        }
        self.fields['porcion'].widget.attrs = {
            'placeholder': 'Ingrese porciones'
        }
        self.fields['tipo_receta'].label = 'Tipo de receta'
        self.fields['descripcion'].widget.attrs = {
            'rows': 2,
            'placeholder': 'Ingrese una breve descripción',
        }
        self.fields['preparacion'].initial = 'Preparación'
        self.fields['preparacion'].widget = SummernoteWidget(attrs={
            'width': '100%',
            'height': '35em'
        })

        self.helper = FormHelper()
        self.helper.form_class = 'js-validate form-vertical'
        self.helper.form_id = 'form'

        self.helper.layout = Layout(
            Row(
                Div(Field('nombre', css_class='input-required'),
                    Field('porcion', css_class='input-required'),
                    Field('descripcion', ),
                    FieldWithButtons(
                        'tipo_receta',
                        StrictButton("<i class='fa fa-plus'></i>",
                                     css_class="btn-default",
                                     rel="tooltip",
                                     title="Agregar tipo receta",
                                     data_toggle="modal",
                                     data_target="#modal-id")),
                    Field('imagen', ),
                    Field('publicar', ),
                    css_class='col-md-6'),
                Div(Field('preparacion', css_class="input-required"),
                    css_class='col-md-6'),
            ),
            FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ),
        )
Exemple #10
0
    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request', None)
        self.object = kwargs.pop('object', None)

        super(UserForm, self).__init__(*args, **kwargs)
        # print self.request.user
        # self.fields['hidden_field'] = forms.CharField(widget=forms.HiddenInput())
        # print self.hidden_field

        self.fields['password1'] = forms.CharField(
            label=capfirst(_(u'Password')),
            required=False,
            widget=forms.PasswordInput,
            initial='',
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['password2'] = forms.CharField(
            label=capfirst(_(u'Password confirmation')),
            required=False,
            widget=forms.PasswordInput,
            initial='',
            help_text=u'<small class="help-error"></small> %s' %
            _(u'Enter the same password as above, for verification.'),
        )
        groups_final = {}
        self.fields['groups'] = forms.ModelMultipleChoiceField(
            label=u'%s %s' % (capfirst(_(u'groups')), capfirst(_(u'Roles'))),
            required=False,
            queryset=Group.objects.all(),
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        if self.object:
            self.fields['groups'].initial = [
                (e) for e in Group.objects.filter(user=self.object)
            ]

        self.fields['first_name'] = forms.CharField(
            label=capfirst(_(u'first name')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['last_name'] = forms.CharField(
            label=capfirst(_(u'last name')),
            required=True,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['identity_type'] = forms.ChoiceField(
            label=capfirst(_(u'Identity type')),
            required=True,
            # widget=forms.RadioSelect(),
            choices=IDENTITY_TYPE_CHOICES,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['identity_num'] = forms.CharField(
            label=capfirst(_(u'number')),
            required=False,
            help_text=u'<small class="help-error"></small> %s' % _(u' '),
        )
        self.fields['photo'] = forms.ImageField(
            label=capfirst(_(u'Photo')),
            required=False,
            initial='persons/default.png',
            help_text=u'<small class="help-error"></small> %s' %
            _(u'Available formats are JPG, GIF, and PNG.'),
        )

        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field('person_id', ),
            Row(
                Div(Field('first_name', ), css_class='col-md-6'),
                Div(Field('last_name', ), css_class='col-md-6'),
            ),
            Row(
                Div(Field('identity_type', ), css_class='col-md-6'),
                Div(Field('identity_num', ), css_class='col-md-6'),
            ),
            Row(
                Div(Field('username',
                          autofocus=True,
                          autocomplete='off',
                          css_class='input-required'),
                    css_class='col-md-6'),
                Div(Field('email', ), css_class='col-md-6'),
            ),
            Row(
                Div(Field('password1', autocomplete='off'),
                    css_class='col-md-6'),
                Div(Field('password2', autocomplete='off'),
                    css_class='col-md-6'),
            ),
            Row(Div(Field('groups'), css_class='col-md-12'), ),
            Row(Div(Field('photo'), css_class='col-md-6'), ),
            Row(FormActions(
                smtSave(),
                btnCancel(),
                btnReset(),
            ), ),
        )