# -*- encoding: utf-8 -*- from django.contrib.admindocs.views import model_detail from django.contrib.auth.models import User from django.db import models # Create your models here. class Archivo(models.Model): archivo = models.CharField(max_length=300, null=True) fecha_registro = models.DateField(null=True, blank=True, auto_now_add=True) def __unicode__(self): return self.archivo class Periodo(models.Model): periodo = models.CharField(max_length=300,null=True) descripcion = models.CharField(max_length=300,null=True) def __unicode__(self): return self.descripcion class Campos(models.Model): cdrRecordType = models.CharField(max_length=300, null=True, blank=True) globalCallID_callManagerId = models.CharField(max_length=300, null=True) globalCallID_callId = models.CharField(max_length=300, null=True) origLegCallIdentifier = models.CharField(max_length=300, null=True) dateTimeOrigination = models.CharField(max_length=300, null=True) origNodeId = models.CharField(max_length=300, null=True) origSpan = models.CharField(max_length=300, null=True) origIpAddr = models.CharField(max_length=300, null=True) callingpartynumber = models.CharField(max_length=300, null=True) callingpartyUnicodeLoginUserID = models.CharField(max_length=300, null=True) origCause_location = models.CharField(max_length=300, null=True) origCause_value = models.CharField(max_length=300, null=True) origPrecedenceLevel = models.CharField(max_length=300, null=True) origMediaTransportAddress_IP = models.CharField(max_length=300, null=True) origMediaTransportAddress_Port = models.CharField(max_length=300, null=True) origMediaCap_payloadCapability = models.CharField(max_length=300, null=True) origMediaCap_maxFramesPerPacket = models.CharField(max_length=300, null=True) origMediaCap_g723BitRate = models.CharField(max_length=300, null=True) origVideoCap_Codec = models.CharField(max_length=300, null=True) origVideoCap_Bandwidth = models.CharField(max_length=300, null=True) origVideoCap_Resolution = models.CharField(max_length=300, null=True) origVideoTransportAddress_IP = models.CharField(max_length=300, null=True) origVideoTransportAddress_Port = models.CharField(max_length=300, null=True) origRSVPAudioStat = models.CharField(max_length=300, null=True) origRSVPVideoStat = models.CharField(max_length=300, null=True) destLegIdentifier = models.CharField(max_length=300, null=True) destNodeId = models.CharField(max_length=300, null=True) destSpan = models.CharField(max_length=300, null=True) destIpAddr = models.CharField(max_length=300, null=True) originalCalledPartyNumber = models.CharField(max_length=300, null=True) finalCalledPartyNumber = models.CharField(max_length=300, null=True) finalCalledPartyUnicodeLoginUserID = models.CharField(max_length=300, null=True) destCause_location = models.CharField(max_length=300, null=True) destCause_value = models.CharField(max_length=300, null=True) destPrecedenceLevel = models.CharField(max_length=300, null=True) destMediaTransportAddress_IP = models.CharField(max_length=300, null=True) destMediaTransportAddress_Port = models.CharField(max_length=300, null=True) destMediaCap_payloadCapability = models.CharField(max_length=300, null=True) destMediaCap_maxFramesPerPacket = models.CharField(max_length=300, null=True) destMediaCap_g723BitRate = models.CharField(max_length=300, null=True) destVideoCap_Codec = models.CharField(max_length=300, null=True) destVideoCap_Bandwidth = models.CharField(max_length=300, null=True) destVideoCap_Resolution = models.CharField(max_length=300, null=True) destVideoTransportAddress_IP = models.CharField(max_length=300, null=True) destVideoTransportAddress_Port = models.CharField(max_length=300, null=True) destRSVPAudioStat = models.CharField(max_length=300, null=True) destRSVPVideoStat = models.CharField(max_length=300, null=True) dateTimeConnect = models.CharField(max_length=300, null=True) dateTimeDisconnect = models.CharField(max_length=300, null=True) lastredirectdn = models.CharField(max_length=300, null=True) pkid = models.CharField(max_length=300, null=True) originalCalledPartyNumberPartition = models.CharField(max_length=300, null=True) callingPartyNumberPartition = models.CharField(max_length=300, null=True) finalCalledPartyNumberPartition = models.CharField(max_length=300, null=True) lastRedirectDnPartition = models.CharField(max_length=300, null=True) duration = models.CharField(max_length=300, null=True) origDeviceName = models.CharField(max_length=300, null=True) destDeviceName = models.CharField(max_length=300, null=True) origCallTerminationOnBehalfOf = models.CharField(max_length=300, null=True) destCallTerminationOnBehalfOf = models.CharField(max_length=300, null=True) origCalledPartyRedirectOnBehalfOf = models.CharField(max_length=300, null=True) lastRedirectRedirectOnBehalfOf = models.CharField(max_length=300, null=True) origCalledPartyRedirectReason = models.CharField(max_length=300, null=True) lastRedirectRedirectReason = models.CharField(max_length=300, null=True) destConversationId = models.CharField(max_length=300, null=True) globalCallId_ClusterID = models.CharField(max_length=300, null=True) joinOnBehalfOf = models.CharField(max_length=300, null=True) comment = models.CharField(max_length=300, null=True) authCodeDescription = models.CharField(max_length=300, null=True) authorizationLevel = models.CharField(max_length=300, null=True) clientMatterCode = models.CharField(max_length=300, null=True) origDTMFMethod = models.CharField(max_length=300, null=True) destDTMFMethod = models.CharField(max_length=300, null=True) callSecuredStatus = models.CharField(max_length=300, null=True) origConversationId = models.CharField(max_length=300, null=True) origMediaCap_Bandwidth = models.CharField(max_length=300, null=True) destMediaCap_Bandwidth = models.CharField(max_length=300, null=True) authorizationCodeValue = models.CharField(max_length=300, null=True) outpulsedCallingPartyNumber = models.CharField(max_length=300, null=True) outpulsedCalledPartyNumber = models.CharField(max_length=300, null=True) origIpv4v6Addr = models.CharField(max_length=300, null=True) destIpv4v6Addr = models.CharField(max_length=300, null=True) origVideoCap_Codec_Channel2 = models.CharField(max_length=300, null=True) origVideoCap_Bandwidth_Channel2 = models.CharField(max_length=300, null=True) origVideoCap_Resolution_Channel2 = models.CharField(max_length=300, null=True) origVideoTransportAddress_IP_Channel2 = models.CharField(max_length=300, null=True) origVideoTransportAddress_Port_Channel2 = models.CharField(max_length=300, null=True) origVideoChannel_Role_Channel2 = models.CharField(max_length=300, null=True) destVideoCap_Codec_Channel2 = models.CharField(max_length=300, null=True) destVideoCap_Bandwidth_Channel2 = models.CharField(max_length=300, null=True) destVideoCap_Resolution_Channel2 = models.CharField(max_length=300, null=True) destVideoTransportAddress_IP_Channel2 = models.CharField(max_length=300, null=True) destVideoTransportAddress_Port_Channel2 = models.CharField(max_length=300, null=True) destVideoChannel_Role_Channel2 = models.CharField(max_length=300, null=True) incomingProtocolID = models.CharField(max_length=300, null=True) incomingProtocolCallRef = models.CharField(max_length=300, null=True) outgoingProtocolID = models.CharField(max_length=300, null=True) outgoingProtocolCallRef = models.CharField(max_length=300, null=True) currentRoutingReason = models.CharField(max_length=300, null=True) origRoutingReason = models.CharField(max_length=300, null=True) lastRedirectingRoutingReason = models.CharField(max_length=300, null=True) huntPilotDN = models.CharField(max_length=300, null=True) huntPilotPartition = models.CharField(max_length=300, null=True) calledPartyPatternUsage = models.CharField(max_length=300, null=True) outpulsedOriginalCalledPartyNumber = models.CharField(max_length=300, null=True) outpulsedLastRedirectingNumber = models.CharField(max_length=300, null=True) wasCallQueued = models.CharField(max_length=300, null=True) totalWaitTimeInQueue = models.CharField(max_length=300, null=True) callingPartyNumber_uri = models.CharField(max_length=300, null=True) originalCalledPartyNumber_uri = models.CharField(max_length=300, null=True) finalCalledPartyNumber_uri = models.CharField(max_length=300, null=True) lastRedirectDn_uri = models.CharField(max_length=300, null=True) fecha_registro = models.DateField(null=True, blank=True, auto_now_add=True) archivo = models.ForeignKey(Archivo) parseofecha = models.CharField(max_length=100, null=True) periodo = models.ForeignKey(Periodo) def __unicode__(self): return self.authCodeDescription class Departamentos(models.Model): descripcion = models.CharField(max_length=300,null=True,blank=True) def __unicode__(self): return self.descripcion #Modelo para las extensiones class Extensiones(models.Model): extension = models.CharField(max_length=300) descripcion = models.CharField(max_length=30) def __unicode__(self): return self.extension #------------------------------------# #Modelo para asignar extensiones a los usuarios class ExtensionesUsuarios(models.Model): usuario = models.ForeignKey(User) extension = models.ManyToManyField(Extensiones) def __unicode__(self): return self.usuario.username #---------------------------------------------- #Modelo para desglosar todas las extensiones class CatExtensiones(models.Model): rango_extension = models.ForeignKey(Extensiones)#Relacion para la tabla ExtensionesUsuarios numExtension = models.IntegerField() descripcion = models.CharField(max_length=300) def __unicode__(self): return self.descripcion #------------------------------------------# class Usuarios (models.Model): extension = models.ForeignKey(CatExtensiones, null=True) nombre_usuario = models.CharField(max_length=300, null=True, blank=True) #nombre_departamento = models.CharField(max_length=300, null=True, blank=True) departamento = models.ForeignKey(Departamentos) fecha_registro = models.DateField(null=True, blank=True, auto_now_add=True) activo = models.IntegerField(null=True, blank=True, default=1) def __unicode__(self): return self.nombre_usuario class Tarifas (models.Model): llamada = models.CharField(max_length=100, null=True, blank=True) importe_llamada = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) def __unicode__(self): return self.llamada # Modelo para los permisos del usuario class Permiso(models.Model): class Meta: permissions = ( ("ver_reportes","ver reportes"), ("cargar_archivo","cargar archivo"), ("listar_usuario","Listar usuarios"), ("listar_tarifas","Listar Tarifas"), ) #-------------------------------------------- tipo_permiso = ((1,'Reporte'), (2,'Usuarios,Tarifas,Reportes,Permisos'), (3,'Administrador')) User.add_to_class('tipo_permisos', models.IntegerField(default=1,choices=tipo_permiso))