from django.db import models from django.contrib.auth.models import User class CatAlbergue(models.Model): idAlbergue = models.IntegerField(primary_key = True) nombre = models.CharField(max_length = 100) def __unicode__(self): return self.nombre class NivelAcceso(models.Model): idNivelAcceso = models.IntegerField(primary_key = True) nivel = models.CharField(max_length = 100) descripcion = models.CharField(max_length = 20) def __unicode__(self): return self.descripcion class Usuario(models.Model): idUser = models.ForeignKey(User) idNivelAcceso = models.ForeignKey(NivelAcceso) idAlbergue = models.ForeignKey(CatAlbergue) clave = models.CharField(max_length = 15) nombre = models.CharField(max_length = 50) apellidos = models.CharField(max_length = 50) apPaterno = models.CharField(max_length = 50) apMaterno = models.CharField(max_length = 50) alias = models.CharField(max_length = 6) Sexualidad = ( ('M', 'Masculino'), ('F', 'Femenino'), ) sexo = models.CharField(max_length = 1, choices = Sexualidad) tipoPlaza = models.CharField(max_length = 20) categoria = models.CharField(max_length = 20) ubicacion = models.CharField(max_length = 20) area = models.CharField(max_length = 20) funcion = models.CharField(max_length = 20) horario = models.CharField(max_length = 50) profesion = models.CharField(max_length = 20) telCasa = models.CharField(max_length = 20) telMovil = models.CharField(max_length = 20) telContacto = models.CharField(max_length = 20) codPost = models.CharField(max_length = 5) domicilio = models.CharField(max_length = 200) fechaIngreso = models.DateField() fechaNac = models.DateField() turno = models.CharField(max_length = 30) noTarjeta = models.IntegerField() foto = models.CharField(max_length = 250) observaciones = models.CharField(max_length = 150) usuario = models.BooleanField() activo = models.BooleanField() riesgo = models.CharField(max_length = 12) password = models.CharField(max_length = 6) cedProf = models.CharField(max_length = 10) curp = models.CharField(max_length = 20) def __unicode__(self): return u'%s %s %s' % (self.nombre, self.apPaterno, self.apMaterno) class CatEdoCivil(models.Model): idEdoCivil = models.IntegerField(primary_key = True) descripcion = models.CharField(max_length = 20) def __unicode__(self): return self.descripcion class CatTipoFamilia(models.Model): idTipoFamilia = models.IntegerField(primary_key = True) descripcion = models.CharField(max_length = 20) def __unicode__(self): return self.descripcion class CatHospital(models.Model): idHospital = models.IntegerField(primary_key = True) nombre = models.CharField(max_length = 100) def __unicode__(self): return self.nombre class CatPais(models.Model): idPais = models.IntegerField(primary_key = True) nombre = models.CharField(max_length = 20) def __unicode__(self): return self.nombre class CatEstado(models.Model): idEstado = models.IntegerField(primary_key = True) Pais = models.ForeignKey(CatPais) nombre = models.CharField(max_length = 30) def __unicode__(self): return self.nombre class CatMunicipio(models.Model): idMunicipio = models.IntegerField(primary_key = True) Pais = models.ForeignKey(CatPais) Estado = models.ForeignKey(CatEstado) nombre = models.CharField(max_length = 50) def __unicode__(self): return self.nombre class CatPoblacion(models.Model): idPoblacion = models.IntegerField(primary_key = True) descripcion = models.CharField(max_length = 20) def __unicode__(self): return self.descripcion class CatEscolaridad(models.Model): idEscolaridad = models.IntegerField(primary_key = True) descripcion = models.CharField(max_length = 25) def __unicode__(self): return self.descripcion class CatOcupacion(models.Model): idOcupacion = models.IntegerField(primary_key = True) descripcion = models.CharField(max_length = 30) def __unicode__(self): return self.descripcion class CatVivienda(models.Model): idVivienda = models.IntegerField(primary_key = True) descripcion = models.CharField(max_length = 20) def __unicode__(self): return self.descripcion class CatPersona(models.Model): idPersona = models.IntegerField(primary_key = True) idUser = models.ForeignKey(User) Nombre = models.CharField(max_length = 250) ApPaterno = models.CharField(max_length = 50, blank=True, null=True, verbose_name='Apellido Paterno') ApMaterno = models.CharField(max_length = 50, blank=True, null=True, verbose_name='Apellido Materno') nombreLargo = models.CharField(max_length = 250, blank=True, null=True, verbose_name='Nombre Completo') FechaNacimiento = models.DateField(blank=True, null=True, verbose_name='Fecha de Nacimiento') FechaIngreso = models.DateField(verbose_name='Fecha de Ingreso') Edad = models.IntegerField() Sexualidad = ( ('M', 'Masculino'), ('F', 'Femenino'), ) Sexo = models.CharField(max_length = 1, choices = Sexualidad) EdoCivil = models.ForeignKey(CatEdoCivil, verbose_name='Estado Civil') Pais = models.ForeignKey(CatPais) Estado = models.ForeignKey(CatEstado) Municipio = models.ForeignKey(CatMunicipio) Poblacion = models.ForeignKey(CatPoblacion) Escolaridad = models.ForeignKey(CatEscolaridad) Ocupacion = models.ForeignKey(CatOcupacion) Vivienda = models.ForeignKey(CatVivienda) TipoFamilia = models.ForeignKey(CatTipoFamilia, verbose_name='Tipo de Familia') Activo = models.BooleanField() TelContacto = models.CharField(max_length = 20, blank=True, null=True) observaciones = models.CharField(verbose_name='CURP', max_length = 250, blank=True, null=True) refIdViejo = models.IntegerField(blank=True, null=True) def __unicode__(self): return unicode(u''+str(self.idPersona)+' '+self.Nombre+' '+self.ApPaterno+' '+self.ApMaterno) class Meta: permissions = ( ('configuracion_albergado', 'Configuracion al Albergado'), ) class CatParentesco(models.Model): idParentesco = models.IntegerField(primary_key = True) descripcion = models.CharField(max_length = 30) def __unicode__(self): return self.descripcion class Meta: permissions = ( ('consulta_espacio', 'Consultar a los espacios'), ) class CatEspecialidad(models.Model): idEspecialidad = models.IntegerField(primary_key = True) especialidad = models.CharField(max_length = 100) def __unicode__(self): return self.especialidad class Dependientes(models.Model): idDependiente = models.IntegerField(primary_key = True) idUser = models.ForeignKey(User) Dependo_de = models.ForeignKey(CatPersona) Nombre = models.CharField(max_length = 250) ApPaterno = models.CharField(max_length = 50, blank=True, null=True) ApMaterno = models.CharField(max_length = 50, blank=True, null=True) nombreLargo = models.CharField(max_length = 250, blank=True, null=True) FechaNacimiento = models.DateField(blank=True, null=True) Edad = models.IntegerField() Sexualidad = ( ('M', 'Masculino'), ('F', 'Femenino'), ) Sexo = models.CharField(max_length = 1, choices = Sexualidad) Parentesco = models.ForeignKey(CatParentesco) def __unicode__(self): return self.Nombre