source: sapic/explicacion_situacional/forms.py @ cd20b73

Last change on this file since cd20b73 was 72e62e0, checked in by ltroconis <ltroconis@…>, 6 años ago

Actualización de README.rst, actualización de requerimientos.txt, agregadas validaciones en registro de usuarios

  • Propiedad mode establecida a 100644
File size: 4.7 KB
Línea 
1# -*- coding: utf-8 -*-
2"""
3Sistema Automatizado de Planificación Integral Comunal SAPIC
4
5Copyleft (@) 2017 CENDITEL nodo Mérida - Copyleft (@) 2017 CENDITEL nodo Mérida - https://planificacion.cenditel.gob.ve/trac/wiki/WikiStart#a5.-SistemaAutomatizadodePlanificaciónIntegralComunalSAPIC
6"""
7## @package explicacion_situacional.forms
8#
9# Formularios correspondientes a la explicacion situacional
10# @author Ing. Leonel Paolo Hernandez Macchiarulo (lhernandez at cenditel.gob.ve)
11# @author <a href='http://www.cenditel.gob.ve'>Centro Nacional de Desarrollo e Investigación en Tecnologías Libres
12# (CENDITEL) nodo Mérida - Venezuela</a>
13# @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
14# @version 1.0
15
16from django.contrib.gis import forms
17from django.forms.fields import (
18    CharField
19)
20
21from explicacion_situacional.modelsExplicacion.modelsExplicacionesSituacional import *
22
23
24class ExplicacionForms(forms.ModelForm):
25    """!
26    Clase que permite crear el formulario para la explicacion situacional
27
28    @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve)
29    @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
30    @date 09-01-2017
31    @version 1.0.0
32    """
33
34    class Meta:
35        """!
36        Clase que construye los meta datos del formulario
37
38        @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve)
39        @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
40        @date 18-09-2017
41        @version 1.0.0
42        """
43        model = ExplicacionSituacional
44        fields = '__all__'
45
46    def __init__(self, *args, **kwargs):
47        """!
48        Funcion que muestra el init del formulario
49
50        @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve)
51        @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
52        @date 18-09-2017
53        """
54        super(ExplicacionForms, self).__init__(*args, **kwargs)
55        self.fields['fk_organizacion'].widget.attrs.update({
56                                      'class': 'form-control'})
57        self.fields['fk_organizacion'].empty_label = 'Seleccione la \
58                                                     organizacion social'
59        self.fields['fk_organizacion'].label = 'Organizacion Social'
60        self.fields['fk_organizacion'].required = True
61
62        self.fields['coordenadas'].widget = forms.OSMWidget.template_name = 'openlayers-es.html'
63        self.fields['coordenadas'].widget = forms.OSMWidget(attrs={
64                                    'default_zoom': 5.2, 'map_width': 600,
65                                    'map_height': 400, 'default_lat': 8,
66                                    'default_lon': -66})
67        self.fields['coordenadas'].required = True
68
69        self.fields['map_cartografico'].widget.attrs.update({'class':'form-control',
70                                                   'data-show-preview':'true',
71                                                   'accept':'image/*'})
72        self.fields['map_cartografico'].label = 'Mapa cartografico'
73        self.fields['map_cartografico'].required = True
74
75
76
77class UbicacionForms(forms.Form):
78    """!
79    Clase que permite crear el formulario para el tipo de preguntas que requieren ubicacion
80
81    @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve)
82    @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
83    @date 20-09-2017
84    @version 1.0.0
85    """
86    ubicacion = CharField()
87
88    class Meta:
89        """!
90        Clase que construye los meta datos del formulario
91
92        @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve)
93        @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
94        @date 18-09-2017
95        @version 1.0.0
96        """
97        fields = ('ubicacion')
98
99    def __init__(self, *args, **kwargs):
100        """!
101        Funcion que muestra el init del formulario
102
103        @author Ing. Leonel P. Hernandez M. (lhernandez at cenditel.gob.ve)
104        @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
105        @date 18-09-2017
106        """
107        super(UbicacionForms, self).__init__(*args, **kwargs)
108
109        self.fields['ubicacion'].widget = forms.OSMWidget.template_name = 'openlayers-es.html'
110        self.fields['ubicacion'].widget = forms.OSMWidget(attrs={
111                                    'default_zoom': 5.2, 'map_width': 600,
112                                    'map_height': 400, 'default_lat': 8,
113                                    'default_lon': -66})
114        self.fields['ubicacion'].required = True
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.