[bf47591] | 1 | |
---|
| 2 | from django import forms |
---|
[94b3e3f] | 3 | from django.forms.fields import ( |
---|
| 4 | CharField, BooleanField |
---|
| 5 | ) |
---|
[bf47591] | 6 | |
---|
| 7 | from .models import * |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | class EventoForm(forms.ModelForm): |
---|
| 11 | """! |
---|
| 12 | Clase que permite crear el formulario para el create or update del evento |
---|
| 13 | |
---|
| 14 | @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve) |
---|
[5dea5ff] | 15 | @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> |
---|
[bf47591] | 16 | @date 19-11-2017 |
---|
| 17 | @version 1.0.0 |
---|
| 18 | """ |
---|
[94b3e3f] | 19 | archivo = CharField() |
---|
[d3c0ab7] | 20 | |
---|
[bf47591] | 21 | class Meta: |
---|
| 22 | """! |
---|
| 23 | Clase que construye los meta datos del formulario |
---|
| 24 | """ |
---|
| 25 | model = Evento |
---|
[8fa24c3] | 26 | exclude = ['activo', 'serial'] |
---|
[bf47591] | 27 | |
---|
| 28 | def __init__(self, *args, **kwargs): |
---|
| 29 | """! |
---|
| 30 | Funcion que construye los valores iniciales del formulario evento |
---|
| 31 | """ |
---|
| 32 | super(EventoForm, self).__init__(*args, **kwargs) |
---|
| 33 | self.fields['nombre_evento'].widget.attrs.update( |
---|
| 34 | {'class': 'form-control', |
---|
| 35 | 'placeholder': 'Nombre del evento'}) |
---|
| 36 | self.fields['fecha'].widget.attrs.update( |
---|
[3397a08] | 37 | {'class': 'datepicker', |
---|
[94b3e3f] | 38 | 'placeholder': 'Fecha', |
---|
| 39 | 'readonly': |
---|
| 40 | 'readonly'}) |
---|
[d9b20e6] | 41 | self.fields['archivo'].required = False |
---|
[3397a08] | 42 | self.fields['archivo'].widget.attrs.update( |
---|
[d3c0ab7] | 43 | {'class': 'file-path validate', |
---|
[a4764f9] | 44 | 'placeholder': 'Subir Archivo', |
---|
| 45 | 'accept': '.pdf'}) |
---|
[ad59aa1] | 46 | self.fields['pos_x'].widget = forms.HiddenInput() |
---|
[eb2672b] | 47 | self.fields['pos_x'].required=False |
---|
[ad59aa1] | 48 | self.fields['pos_y'].widget = forms.HiddenInput() |
---|
[eb2672b] | 49 | self.fields['pos_y'].required=False |
---|
[6312fce] | 50 | self.fields['pag'].widget = forms.HiddenInput() |
---|
[eb2672b] | 51 | self.fields['pag'].required=False |
---|
[248b1b4] | 52 | |
---|
| 53 | |
---|
| 54 | class FirmaEventoForm(forms.Form): |
---|
| 55 | """! |
---|
| 56 | Clase que permite crear el formulario para la firma de un documento |
---|
| 57 | |
---|
| 58 | @author Rodrigo Boet (rboet at cenditel.gob.ve) |
---|
[5dea5ff] | 59 | @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> |
---|
[248b1b4] | 60 | @date 20-11-2017 |
---|
| 61 | @version 1.0.0 |
---|
| 62 | """ |
---|
[16cf088] | 63 | pasaporte = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control','placeholder':'Ingrese su pasaporte'})) |
---|
[bc3aa92] | 64 | |
---|
| 65 | |
---|
| 66 | class UpdateFileEventoForm(forms.Form): |
---|
| 67 | archivo = CharField() |
---|
| 68 | pos_x = CharField() |
---|
| 69 | pos_y = CharField() |
---|
| 70 | pag = CharField() |
---|
| 71 | |
---|
| 72 | class Meta: |
---|
| 73 | """! |
---|
| 74 | Clase que construye los meta datos del formulario |
---|
| 75 | """ |
---|
| 76 | fields = ['archivo'] |
---|
| 77 | |
---|
| 78 | def __init__(self, *args, **kwargs): |
---|
| 79 | """! |
---|
| 80 | Funcion que construye los valores iniciales del formulario evento |
---|
| 81 | """ |
---|
| 82 | super(UpdateFileEventoForm, self).__init__(*args, **kwargs) |
---|
| 83 | self.fields['archivo'].required = True |
---|
| 84 | self.fields['archivo'].widget.attrs.update( |
---|
| 85 | {'class': 'file-path validate', |
---|
| 86 | 'placeholder': 'Subir Archivo', |
---|
| 87 | 'accept': '.pdf'}) |
---|
| 88 | self.fields['pos_x'].required = True |
---|
| 89 | self.fields['pos_x'].widget = forms.HiddenInput() |
---|
| 90 | self.fields['pos_y'].required = True |
---|
| 91 | self.fields['pos_y'].widget = forms.HiddenInput() |
---|
| 92 | self.fields['pag'].required = True |
---|
| 93 | self.fields['pag'].widget = forms.HiddenInput() |
---|