1 | |
---|
2 | from django import forms |
---|
3 | from django.forms.fields import ( |
---|
4 | CharField, BooleanField |
---|
5 | ) |
---|
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) |
---|
15 | @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> |
---|
16 | @date 19-11-2017 |
---|
17 | @version 1.0.0 |
---|
18 | """ |
---|
19 | archivo = CharField() |
---|
20 | |
---|
21 | class Meta: |
---|
22 | """! |
---|
23 | Clase que construye los meta datos del formulario |
---|
24 | """ |
---|
25 | model = Evento |
---|
26 | exclude = ['activo', 'serial'] |
---|
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( |
---|
37 | {'class': 'datepicker', |
---|
38 | 'placeholder': 'Fecha', |
---|
39 | 'readonly': |
---|
40 | 'readonly'}) |
---|
41 | self.fields['archivo'].required = True |
---|
42 | self.fields['archivo'].widget.attrs.update( |
---|
43 | {'class': 'file-path validate', |
---|
44 | 'placeholder': 'Subir Archivo', |
---|
45 | 'accept': '.pdf'}) |
---|
46 | self.fields['pos_x'].widget = forms.HiddenInput() |
---|
47 | self.fields['pos_y'].widget = forms.HiddenInput() |
---|
48 | self.fields['pag'].widget = forms.HiddenInput() |
---|
49 | |
---|
50 | class FirmaEventoForm(forms.Form): |
---|
51 | """! |
---|
52 | Clase que permite crear el formulario para la firma de un documento |
---|
53 | |
---|
54 | @author Rodrigo Boet (rboet at cenditel.gob.ve) |
---|
55 | @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> |
---|
56 | @date 20-11-2017 |
---|
57 | @version 1.0.0 |
---|
58 | """ |
---|
59 | pasaporte = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control','placeholder':'Ingrese su pasaporte'})) |
---|
60 | |
---|
61 | |
---|
62 | class UpdateFileEventoForm(forms.Form): |
---|
63 | archivo = CharField() |
---|
64 | pos_x = CharField() |
---|
65 | pos_y = CharField() |
---|
66 | pag = CharField() |
---|
67 | |
---|
68 | class Meta: |
---|
69 | """! |
---|
70 | Clase que construye los meta datos del formulario |
---|
71 | """ |
---|
72 | fields = ['archivo'] |
---|
73 | |
---|
74 | def __init__(self, *args, **kwargs): |
---|
75 | """! |
---|
76 | Funcion que construye los valores iniciales del formulario evento |
---|
77 | """ |
---|
78 | super(UpdateFileEventoForm, self).__init__(*args, **kwargs) |
---|
79 | self.fields['archivo'].required = True |
---|
80 | self.fields['archivo'].widget.attrs.update( |
---|
81 | {'class': 'file-path validate', |
---|
82 | 'placeholder': 'Subir Archivo', |
---|
83 | 'accept': '.pdf'}) |
---|
84 | self.fields['pos_x'].required = True |
---|
85 | self.fields['pos_x'].widget = forms.HiddenInput() |
---|
86 | self.fields['pos_y'].required = True |
---|
87 | self.fields['pos_y'].widget = forms.HiddenInput() |
---|
88 | self.fields['pag'].required = True |
---|
89 | self.fields['pag'].widget = forms.HiddenInput() |
---|