Last active
December 31, 2018 03:44
-
-
Save cjadeveloper/3e4e9b75a259681f63c5f5b784169572 to your computer and use it in GitHub Desktop.
Filtro Personalizado por Provincia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
# Create your models here. | |
class Cliente(models.Model): | |
""" | |
Modelo simplificado de Clientes. Solo para efectos del ejemplo. | |
""" | |
# Provincias de la República Argentina. | |
# Tupla('codigo','provincia') | |
PROVINCIAS = ( | |
('0', 'Ciudad Autónoma de Buenos Aires'), | |
('1', 'Buenos Aires'), | |
('2', 'Catamarca'), | |
('3', 'Córdoba'), | |
('4', 'Corrientes'), | |
('5', 'Entre Rios'), | |
('6', 'Jujuy'), | |
('7', 'Mendoza'), | |
('8', 'La Rioja'), | |
('9', 'Salta'), | |
('10', 'San Juan'), | |
('11', 'San Luis',), | |
('12', 'Santa Fe'), | |
('13', 'Santiago del Estero'), | |
('14', 'Tucumán'), | |
('16', 'Chaco'), | |
('17', 'Chubut'), | |
('18', 'Formosa'), | |
('19', 'Misiones'), | |
('20', 'Neuquén'), | |
('21', 'La Pampa'), | |
('22', 'Río Negro'), | |
('23', 'Santa Cruz'), | |
('24', 'Tierra Del Fuego'), | |
) | |
nombre = models.CharField( | |
max_length=50, verbose_name='Nombre') | |
apellido = models.CharField( | |
max_length=50, verbose_name='Apellido') | |
direccion = models.CharField( | |
max_length=100, verbose_name='Dirección', blank=True) | |
ciudad = models.CharField( | |
max_length=50, verbose_name='Localidad', blank=True) | |
provincia = models.CharField( | |
max_length=2, verbose_name='Provincia', choices=PROVINCIAS, default='0') | |
class Meta: | |
verbose_name = 'Cliente' | |
verbose_name_plural = 'Clientes' | |
def __str__(self): | |
return f'{self.apellido} {self.nombre}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment