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 = False |
---|
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_x'].required=False |
---|
48 | self.fields['pos_y'].widget = forms.HiddenInput() |
---|
49 | self.fields['pos_y'].required=False |
---|
50 | self.fields['pag'].widget = forms.HiddenInput() |
---|
51 | self.fields['pag'].required=False |
---|
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) |
---|
59 | @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> |
---|
60 | @date 20-11-2017 |
---|
61 | @version 1.0.0 |
---|
62 | """ |
---|
63 | pasaporte = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control','placeholder':'Ingrese su pasaporte'})) |
---|
64 | |
---|
65 | |
---|
66 | class UpdateFileEventoForm(forms.Form): |
---|
67 | """! |
---|
68 | Clase que permite crear el formulario para subir un documento a un evento |
---|
69 | |
---|
70 | @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve) |
---|
71 | @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> |
---|
72 | @date 19-11-2017 |
---|
73 | @version 1.0.0 |
---|
74 | """ |
---|
75 | archivo = CharField() |
---|
76 | pos_x = CharField() |
---|
77 | pos_y = CharField() |
---|
78 | pag = CharField() |
---|
79 | |
---|
80 | class Meta: |
---|
81 | """! |
---|
82 | Clase que construye los meta datos del formulario |
---|
83 | """ |
---|
84 | fields = ['archivo'] |
---|
85 | |
---|
86 | def __init__(self, *args, **kwargs): |
---|
87 | """! |
---|
88 | Funcion que construye los valores iniciales del formulario evento |
---|
89 | """ |
---|
90 | super(UpdateFileEventoForm, self).__init__(*args, **kwargs) |
---|
91 | self.fields['archivo'].required = True |
---|
92 | self.fields['archivo'].widget.attrs.update( |
---|
93 | {'class': 'file-path validate', |
---|
94 | 'placeholder': 'Subir Archivo', |
---|
95 | 'accept': '.pdf'}) |
---|
96 | self.fields['pos_x'].required = True |
---|
97 | self.fields['pos_x'].widget = forms.HiddenInput() |
---|
98 | self.fields['pos_y'].required = True |
---|
99 | self.fields['pos_y'].widget = forms.HiddenInput() |
---|
100 | self.fields['pag'].required = True |
---|
101 | self.fields['pag'].widget = forms.HiddenInput() |
---|
102 | |
---|
103 | |
---|
104 | class UpdateEventoForm(forms.ModelForm): |
---|
105 | """! |
---|
106 | Clase que permite crear el formulario para el update del evento |
---|
107 | |
---|
108 | @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve) |
---|
109 | @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> |
---|
110 | @date 28-11-2017 |
---|
111 | @version 1.0.0 |
---|
112 | """ |
---|
113 | class Meta: |
---|
114 | """! |
---|
115 | Clase que construye los meta datos del formulario |
---|
116 | """ |
---|
117 | model = Evento |
---|
118 | fields = ['nombre_evento', 'fecha'] |
---|
119 | |
---|
120 | def __init__(self, *args, **kwargs): |
---|
121 | """! |
---|
122 | Funcion que construye los valores iniciales del formulario update evento |
---|
123 | """ |
---|
124 | super(UpdateEventoForm, self).__init__(*args, **kwargs) |
---|
125 | self.fields['nombre_evento'].widget.attrs.update( |
---|
126 | {'class': 'form-control', |
---|
127 | 'placeholder': 'Nombre del evento'}) |
---|
128 | self.fields['fecha'].widget.attrs.update( |
---|
129 | {'class': 'datepicker', |
---|
130 | 'placeholder': 'Fecha', |
---|
131 | 'readonly': |
---|
132 | 'readonly'}) |
---|