Last change
on this file since 94b3e3f was
94b3e3f,
checked in by lhernandez <lhernandez@…>, 6 years ago
|
Implementado registro de eventos
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Line | |
---|
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='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a> |
---|
16 | @date 19-11-2017 |
---|
17 | @version 1.0.0 |
---|
18 | """ |
---|
19 | #archivo = forms.FileField(widget=forms.ClearableFileInput( |
---|
20 | #attrs={'multiple': False})) |
---|
21 | archivo = CharField() |
---|
22 | class Meta: |
---|
23 | """! |
---|
24 | Clase que construye los meta datos del formulario |
---|
25 | """ |
---|
26 | model = Evento |
---|
27 | exclude = ['activo', 'serial'] |
---|
28 | |
---|
29 | def __init__(self, *args, **kwargs): |
---|
30 | """! |
---|
31 | Funcion que construye los valores iniciales del formulario evento |
---|
32 | """ |
---|
33 | super(EventoForm, self).__init__(*args, **kwargs) |
---|
34 | self.fields['nombre_evento'].widget.attrs.update( |
---|
35 | {'class': 'form-control', |
---|
36 | 'placeholder': 'Nombre del evento'}) |
---|
37 | self.fields['fecha'].widget.attrs.update( |
---|
38 | {'class': 'datepicker', |
---|
39 | 'placeholder': 'Fecha', |
---|
40 | 'readonly': |
---|
41 | 'readonly'}) |
---|
42 | self.fields['archivo'].required=True |
---|
43 | self.fields['archivo'].widget.attrs.update( |
---|
44 | { |
---|
45 | 'class': 'file-path validate', |
---|
46 | 'placeholder': 'Subur un archivo'}) |
---|
Note: See
TracBrowser
for help on using the repository browser.