def __init__(self, *args, **kwargs): self.request = kwargs.pop('url', None) super(PrecioVentaForm, self).__init__(*args, **kwargs) # self.fields['fecha_emision'] = DateField(input_formats=['%d/%m/%Y'], widget=forms.DateTimeInput(attrs={ # 'class': 'form-control datetimepicker-input', # 'data-target': '#datetimepicker1' # })) self.helper = FormHelper() self.helper.attrs['autocomplete'] = "off" self.helper.form_method = 'post' self.helper.form_action = self.request self.helper.form_class = 'js-validate form-vertical' self.helper.layout = Layout( Row(Div(Field('ruta', css_class='input-required'), css_class='col-md-4'), Div(Field('precio', css_class='input-required'), css_class='col-md-4'), ), Row( FormActions( smtSave(), ), ), )
def __init__(self, *args, **kwargs): super(MenuForm, self).__init__(*args, **kwargs) self.fields[ 'tipo_menu'].help_text = u'<small class="help-error"></small> %s' % ( u' ') self.fields[ 'fecha'].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( Div( HTML( '<button type="button" class="close" data-dismiss="modal" \ aria-hidden="true">×</button>\ <h4 class="modal-title"><i class="fa fa-info"></i>\ Formulario menu</h4>'), css_class="modal-header modal-header-primary", ), Div( Field('tipo_menu', css_class='input-required'), Field('fecha', css_class='input-required'), css_class="modal-body", ), Div(FormActions( smtSave(), Button('cancel', 'Cancel', data_dismiss="modal", css_class="btn-default")), css_class='modal-footer'))
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(), ), ), )
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(), ), ), )
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(), ), ), )
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(), ), ), )
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(), ), ), )
def __init__(self, *args, **kwargs): super(MarcaForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.attrs['autocomplete'] = "off" self.helper.form_class = 'js-validate form-vertical' self.helper.layout = Layout( Row( Div(Field('nombre', css_class='input-required'), css_class='col-md-4'), ), Row(FormActions( smtSave(), btnCancel(), ), ), )
def __init__(self, *args, **kwargs): super(ProveedorForm, self).__init__(*args, **kwargs) self.fields['departamento'] = forms.ModelChoiceField( label="Departamento", required=False, queryset=Departamento.objects.all(), help_text=u'<small class="help-error"></small> %s' % u' ', ) self.fields['provincia'] = forms.ModelChoiceField( label="Provincia", required=False, queryset=Provincia.objects.all(), help_text=u'<small class="help-error"></small> %s' % u' ', ) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.attrs['autocomplete'] = "off" self.helper.form_class = 'js-validate form-vertical' self.helper.layout = Layout( Row( Div(Field('razon_social', css_class='input-required'), css_class='col-md-4'), Div(Field('tipo_documento_identidad', css_class='input-required'), css_class='col-md-4'), Div(Field('nro_documento', css_class='input-required'), css_class='col-md-4'), ), Row( Div(Field('departamento', css_class='input-required'), css_class='col-md-2'), Div(Field('provincia', css_class='input-required'), css_class='col-md-2'), Div( Field('lugar', css_class='input-required'), css_class='col-md-2', ), Div(Field('direccion', css_class='input-required'), css_class='col-md-3'), Div(Field('nro_telefono', css_class='input-required'), css_class='col-md-3'), ), Row(FormActions( smtSave(), btnCancel(), ), ), )
def __init__(self, *args, **kwargs): self.request = kwargs.pop('url', None) super(ProductoSimpleForm, self).__init__(*args, **kwargs) self.fields['descripcion'].widget.attrs['rows'] = 3 self.helper = FormHelper() self.helper.attrs['autocomplete'] = "off" self.helper.form_action = self.request self.helper.form_method = 'post' self.helper.form_class = 'js-validate form-vertical' self.helper.layout = Layout( Row( Div(Field('color', css_class='form_control'), css_class='col-md-6'), ), Row(FormActions( smtSave(), btnCancel(), ), ), )
def __init__(self, *args, **kwargs): super(EquipoUpdateModelForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_method = 'post' self.helper.attrs['autocomplete'] = "off" self.helper.form_class = 'js-validate form-vertical' self.helper.layout = Layout( Row( Div(Field('contable'), css_class='col-md-4'), ), Row( FormActions( smtSave(), btnCancel(), ), ), )
def __init__(self, *args, **kwargs): super(ProductoGeneralForm, self).__init__(*args, **kwargs) self.fields['descripcion'].widget.attrs['rows'] = 2 self.fields['precio_local'] = forms.DecimalField(label="Precio Local") self.fields['precio_regional'] = forms.DecimalField(label="Precio Regional") self.fields['precio_nacional'] = forms.DecimalField(label="Precio Nacional") 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( Fieldset('Producto', Row( Div(Field('marca', css_class='input-required'), css_class='col-md-3'), Div(Field('codigo', css_class='input-required'), css_class='col-md-3'), Div(Field('descripcion', css_class='input-required '), css_class='col-md-3'), Div(Field('imagen', ), css_class='col-md-3'), ), ), Fieldset('Precios', Field('precio_local_id'), Field('precio_regional_id'), Field('precio_nacional_id'), Row( Div(Field('precio_local', css_class='input-required'), css_class='col-md-4'), Div(Field('precio_regional', css_class='input-required'), css_class='col-md-4'), Div(Field('precio_nacional', css_class='input-required'), css_class='col-md-4'), ) ), Row( FormActions( smtSave(msg="Guardar"), btnCancel(), ), ), )
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(), ), ), )
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(), ), ), )
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(), ), )
def __init__(self, *args, **kwargs): super(InsumosDetalleForm, self).__init__(*args, **kwargs) self.fields[ 'insumo'].help_text = u'<small class="help-error"></small> %s' % ( u' ') self.fields[ 'cantidad'].help_text = u'<small class="help-error"></small> %s' % ( u' ') # print(kwargs['initial']['detalle_id']) self.helper = FormHelper() self.helper.form_class = 'js-validate form-vertical' self.helper.form_id = 'form' self.helper.layout = Layout( Div( HTML( '<button type="button" class="close" data-dismiss="modal" \ aria-hidden="true">×</button>\ <h4 class="modal-title"><i class="fa fa-info"></i>\ Formulario Insumos detalle</h4>'), css_class="modal-header modal-header-primary", ), Div( Field('insumo', css_class='input-required select2', style="width:100%"), Field('cantidad', css_class='input-required'), css_class="modal-body", ), Div(FormActions( smtSave(), Button('cancel', 'Cancel', data_dismiss="modal", css_class="btn-default")), css_class='modal-footer'))
def __init__(self, *args, **kwargs): super(CompraForm, self).__init__(*args, **kwargs) # self.fields['fecha_emision'] = DateField(input_formats=['%d/%m/%Y'], widget=forms.DateTimeInput(attrs={ # 'class': 'form-control datetimepicker-input', # 'data-target': '#datetimepicker1' # })) codigos_comprobante = ["01", "03", "99"] self.fields['fecha_emision'] = DateField( input_formats=['%d/%m/%Y'], widget=forms.DateInput( attrs={ 'class': 'form-control datetimepicker-input', 'data-target': '#datetimepicker1' })) self.fields['fecha_vencimiento'] = DateField( input_formats=['%d/%m/%Y'], widget=forms.DateInput( attrs={ 'class': 'form-control datetimepicker-input', 'data-target': '#datetimepicker1' })) codigos_comprobante = ["01", "03", "99"] self.fields[ 'tipo_comprobante'].queryset = TipoComprobantePago.objects.filter( codigo__in=codigos_comprobante) # self.fields['proveedor'].widget = autocomplete.ModelSelect2(url='compra:proveedor_autocomplete',) self.fields['base_imponible'].widget.attrs['readonly'] = True self.fields['igv'].widget.attrs['readonly'] = True # self.fields['fecha_vencimiento'].widget.attrs['readonly'] = True 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( Fieldset( "Comprobate", Div(Field('proveedor', css_class='input-required'), css_class='col-md-3'), Div(Field('serie_comprobante', css_class='input-required'), css_class='col-md-2'), Div(Field('nro_comprobante', css_class='input-required'), css_class='col-md-3'), Div(Field('fecha_emision', css_class='input-required'), css_class='col-md-2'), Div(Field('fecha_vencimiento', ), css_class='col-md-2'), css_class="scheduler-border", )), Fieldset( "Pago", Row(Div(Field('tipo_comprobante', css_class='input-required'), css_class='col-md-4'), Div(Field('tipo_moneda', css_class='input-required'), css_class='col-md-2'), Div(Field('total', css_class='input-required'), css_class='col-md-2'), Div(Field('base_imponible', css_class='input-required'), css_class='col-md-2'), Div(Field('igv', css_class='input-required'), css_class='col-md-2'), css_class="scheduler-border"), ), Row(FormActions( smtSave(), btnCancel(), ), ), )
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(), ), )
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(), ), ), )
def __init__(self, *args, **kwargs): url = kwargs.pop('url', None) compra = kwargs.pop('compra', None) super(CompraUpdateForm, self).__init__(*args, **kwargs) self.fields['base_imponible'].widget.attrs['readonly'] = True self.fields['igv'].widget.attrs['readonly'] = True codigos_comprobante = ["01", "03", "99"] self.fields[ 'tipo_comprobante'].queryset = TipoComprobantePago.objects.filter( codigo__in=codigos_comprobante) self.fields['fecha_emision'] = DateField( input_formats=['%d/%m/%Y'], widget=forms.DateInput(attrs={ 'class': 'form-control datetimepicker-input', 'data-target': '#datetimepicker1' }, format='%d/%m/%Y')) self.fields['fecha_vencimiento'] = DateField( input_formats=['%d/%m/%Y'], widget=forms.DateInput(attrs={ 'class': 'form-control datetimepicker-input', 'data-target': '#datetimepicker1' }, format='%d/%m/%Y')) # self.fields['fecha_vencimiento'].widget.attrs['readonly'] = True self.helper = FormHelper() self.helper.form_method = 'post' self.helper.form_action = url self.helper.form_class = 'js-validate form-vertical' self.helper.layout = Layout( Row( Div(Field('proveedor', css_class='input-required'), css_class='col-md-4'), Div(Field('tipo_comprobante', css_class='input-required'), css_class='col-md-4'), Div(Field('tipo_moneda', css_class='input-required'), css_class='col-md-4'), ), Row( Div(Field('fecha_emision', css_class='input-required'), css_class='col-md-3'), Div(Field('fecha_vencimiento', css_class='input-required'), css_class='col-md-3'), Div(Field('serie_comprobante', css_class='input-required'), css_class='col-md-2'), Div(Field('nro_comprobante', css_class='input-required'), css_class='col-md-4'), ), Row( Div(Field('base_imponible', css_class='input-required'), css_class='col-md-4'), Div(Field('igv', css_class='input-required'), css_class='col-md-4'), Div(Field('total', css_class='input-required'), css_class='col-md-4'), ), Row(FormActions(smtSave("Actualizar"), ), css_class="text-center"), )