source: consulta_publica/base/widgets.py

baseconstituyenteestudiantesgeneralplan_patriasala
Last change on this file was bf6bc0b, checked in by rudmanmrrod <rudman22@…>, 7 años ago

Agregada la permisología de roles al sistema

  • Propiedad mode establecida a 100644
File size: 2.0 KB
Línea 
1# -*- coding: utf-8 -*-
2"""
3Sistema de Consulta Pública
4
5Copyleft (@) 2017 CENDITEL nodo Mérida - https://planificacion.cenditel.gob.ve/trac/wiki/ModeladoTopicos_2017
6"""
7## @package base.constant
8#
9# Contiene las clases, atributos y métodos para los widgets a implementar en los formularios
10# @author Rodrigo Boet (rboet 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
15from __future__ import unicode_literals
16
17from django.forms import MultiWidget, Select, TextInput
18from .constant import SHORT_NACIONALIDAD
19
20class CedulaWidget(MultiWidget):
21    """!
22    Clase que agrupa los widgets de los campos de nacionalidad y número de cédula de identidad
23
24    @author Ing. Roldan Vargas (rvargas at cenditel.gob.ve)
25    @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a>
26    @date 26-04-2016
27    @version 2.0.0
28    """
29
30    def __init__(self, *args, **kwargs):
31
32        widgets = (
33            Select(
34                attrs={
35                    'class': 'select2 form-control', 'data-toggle': 'tooltip',
36                    'title': "Seleccione la nacionalidad"
37                }, choices=SHORT_NACIONALIDAD
38            ),
39            TextInput(
40                attrs={
41                    'class': 'form-control text-center', 'placeholder': '00000000', 'data-mask': '00000000',
42                    'data-toggle': 'tooltip', 'maxlength': '8', 'size':'7', 'data-rule-required': 'true',
43                    'title': "Indique el número de Cédula de Identidad"
44                }
45            )
46        )
47
48        super(CedulaWidget, self).__init__(widgets, *args, **kwargs)
49
50    def format_output(self, rendered_widgets):
51        return ' - '.join(rendered_widgets)
52
53    def decompress(self, value):
54        if value:
55            return [value[0], value[1:]]
56        return [None, None]
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.