Last change
on this file since c9f75d7 was
8fa24c3,
checked in by lhernandez <lhernandez@…>, 7 years ago
|
Generando templates para registrar eventos
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[bf47591] | 1 | |
---|
| 2 | from django import forms |
---|
| 3 | |
---|
| 4 | from .models import * |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | class EventoForm(forms.ModelForm): |
---|
| 8 | """! |
---|
| 9 | Clase que permite crear el formulario para el create or update del evento |
---|
| 10 | |
---|
| 11 | @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve) |
---|
| 12 | @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a> |
---|
| 13 | @date 19-11-2017 |
---|
| 14 | @version 1.0.0 |
---|
| 15 | """ |
---|
[3397a08] | 16 | archivo = forms.FileField(widget=forms.ClearableFileInput( |
---|
| 17 | attrs={'multiple': False})) |
---|
[bf47591] | 18 | |
---|
| 19 | class Meta: |
---|
| 20 | """! |
---|
| 21 | Clase que construye los meta datos del formulario |
---|
| 22 | """ |
---|
| 23 | model = Evento |
---|
[8fa24c3] | 24 | exclude = ['activo', 'serial'] |
---|
[bf47591] | 25 | |
---|
| 26 | def __init__(self, *args, **kwargs): |
---|
| 27 | """! |
---|
| 28 | Funcion que construye los valores iniciales del formulario evento |
---|
| 29 | """ |
---|
| 30 | super(EventoForm, self).__init__(*args, **kwargs) |
---|
| 31 | self.fields['nombre_evento'].widget.attrs.update( |
---|
| 32 | {'class': 'form-control', |
---|
| 33 | 'placeholder': 'Nombre del evento'}) |
---|
| 34 | self.fields['fecha'].widget.attrs.update( |
---|
[3397a08] | 35 | {'class': 'datepicker', |
---|
| 36 | 'placeholder': 'Fecha'}) |
---|
[8fa24c3] | 37 | self.fields['archivo'].required=True |
---|
[3397a08] | 38 | self.fields['archivo'].widget.attrs.update( |
---|
| 39 | {'class': 'file-path', |
---|
| 40 | 'placeholder': 'Subir Archivo'}) |
---|
Note: See
TracBrowser
for help on using the repository browser.