class Viajeros(models.Model): GENERO = { ('F', 'Femenino'), ('M', 'Masculino'), } id_de_identidad = models.IntegerField(primary_key=True) id_ciudad = models.IntegerField() id_pais = models.IntegerField() id_paquete_contrato = models.IntegerField() primer_nombre = models.CharField(max_length=30) segundo_nombre = models.CharField(max_length=30, null=True, blank=True) primer_apellido = models.CharField(max_length=30) segundo_apellido = models.CharField(max_length=30) sexo = models.CharField(max_length=1, choices=GENERO) f_nacimiento = models.DateField() lugar = CompositeForeignKey(Ciudades, on_delete=PROTECT, to_fields={ 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais' }) paquete = CompositeForeignKey( Paquetes_contrato, on_delete=PROTECT, to_fields={'numero_factura': 'id_paquete_contrato'}) def __str__(self): return str(self.id_de_identidad) class Meta: db_table = 'cgr_viajeros' ordering = ['id_de_identidad']
class Puntuaciones(models.Model): id_puntuacion = models.AutoField(primary_key=True) valoracion = models.IntegerField() id_rally = models.ForeignKey(Rallies, on_delete=models.PROTECT, related_name='id_puntuacion_rally', null=True, blank=True, db_column='id_rally') id_paquete_contrato = models.IntegerField() id_ciudad = models.IntegerField(null=True, blank=True) id_pais = models.IntegerField(null=True, blank=True) id_atraccion = models.IntegerField(null=True, blank=True) paquete = CompositeForeignKey( Paquetes_contrato, on_delete=PROTECT, to_fields={'numero_factura': 'id_paquete_contrato'}) lugar = CompositeForeignKey(Atracciones, on_delete=PROTECT, to_fields={ 'id_atraccion': 'id_atraccion', 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais' }) def __str__(self): return str(self.id_puntuacion) class Meta: db_table = 'cgr_puntuaciones' ordering = ['id_puntuacion']
class Formas_de_pago(models.Model): TRAMITES = { ('parcial', 'Parcial'), ('cuotas', 'Cuotas'), } id_forma = models.AutoField(primary_key=True) id_instrumento = models.IntegerField() id_cliente = models.IntegerField() id_paquete_contrato = models.IntegerField() tipo_forma_de_pago = models.CharField(max_length=30, choices=TRAMITES, null=True, blank=True) pago_instrumento = CompositeForeignKey(Instrumentos_de_pago, on_delete=PROTECT, to_fields={ 'id_instrumento': 'id_instrumento', 'doc_identidad_cliente': 'id_cliente' }) paquete = CompositeForeignKey( Paquetes_contrato, on_delete=PROTECT, to_fields={'numero_factura': 'id_paquete_contrato'}) def __str__(self): return str(self.id_forma) class Meta: db_table = 'cgr_formas_de_pago' ordering = ['id_forma']
class Participantes(models.Model): id_partipante = models.AutoField(primary_key=True) id_rally = models.ForeignKey(Rallies, on_delete=models.PROTECT, related_name='id_participantes_rally', db_column='id_rally') id_via_agencia = models.IntegerField(null=True, blank=True) id_via_viajero = models.IntegerField(null=True, blank=True) id_cli_cliente = models.IntegerField(null=True, blank=True) id_cli_agencia = models.IntegerField(null=True, blank=True) equipo = models.BooleanField(null=True, editable=True, blank=True) posicion = models.IntegerField(null=True, blank=True) viajero = CompositeForeignKey(Registro_viajeros, on_delete=PROTECT, to_fields={ 'id_viajero': 'id_via_viajero', 'id_agencia': 'id_via_agencia' }) cliente = CompositeForeignKey(Registro_clientes, on_delete=PROTECT, to_fields={ 'id_cliente': 'id_cli_cliente', 'id_agencia': 'id_cli_agencia' }) def __str__(self): return 'r' + self.id_rally + ' ' + str(self.id_partipante) class Meta: unique_together = [('id_rally', 'id_partipante')] db_table = 'cgr_participantes' ordering = ['id_partipante']
class Detalle_viajeros(models.Model): id_viajero = models.IntegerField(primary_key=True) id_agencia = models.IntegerField() id_paquete_contrato = models.IntegerField() traveler = CompositeForeignKey(Registro_viajeros, on_delete=PROTECT, to_fields={ 'id_viajero': 'id_viajero', 'id_agencia': 'id_agencia' }) paquete = CompositeForeignKey( Paquetes_contrato, on_delete=PROTECT, to_fields={'numero_factura': 'id_paquete_contrato'}) def __str__(self): return 'v: ' + self.id_viajero + ' a: ' + self.id_agencia + ' ' + self.id_paquete_contrato class Meta: unique_together = [('id_viajero', 'id_agencia', 'id_paquete_contrato')] db_table = 'cgr_detalle_viajeros' ordering = ['id_viajero']
class Customer(models.Model): company = models.IntegerField() customer_id = models.IntegerField() name = models.CharField(max_length=255) cod_rep = models.CharField(max_length=2, null=True) # for problem in trim_join, we must try to give the fields in a consistent order with others models... # see #26515 at https://code.djangoproject.com/ticket/26515 # so we always give company first and tiers_id after address = CompositeForeignKey( Address, on_delete=CASCADE, null=True, to_fields=OrderedDict([("company", LocalFieldValue("company")), ("tiers_id", "customer_id"), ("type_tiers", RawFieldValue("C"))]), null_if_equal= [ # if either of the fields company or customer is -1, ther can't have address ("company", -1), ("customer_id", -1) ]) local_address = CompositeForeignKey( Address, on_delete=CASCADE, null=True, to_fields=OrderedDict([ ("company", LocalFieldValue("company")), ("tiers_id", "customer_id"), ("type_tiers", FunctionBasedFieldValue(get_local_type_tiers)) ]), null_if_equal= [ # if either of the fields company or customer is -1, ther can't have address ("company", -1), ("customer_id", -1) ], related_name='customer_local', ) representant = CompositeForeignKey( Representant, on_delete=CASCADE, null=True, to_fields=[ "company", "cod_rep", ], nullable_fields={"cod_rep": ""}, null_if_equal= [ # if either of the fields company or customer is -1, ther can't have address ("cod_rep", ""), ]) class Meta(object): unique_together = [ ("company", "customer_id"), ]
class Circuitos(models.Model): orden_circuito = models.IntegerField(primary_key=True) id_rally = models.ForeignKey(Rallies, on_delete=models.PROTECT, null=False, related_name='id_rally_cir', db_column='id_rally') id_ciudad = models.IntegerField() id_pais = models.IntegerField() maxdias = models.IntegerField() lugar = CompositeForeignKey(Ciudades, on_delete=PROTECT, to_fields={ 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais' }) def __str__(self): return str(self.orden_circuito) + '- ' + self.id_rally + ' c: ' + str( self.id_ciudad) + ' p: ' + str(self.id_pais) class Meta: unique_together = [('orden_circuito', 'id_rally', 'id_ciudad', 'id_pais')] db_table = 'cgr_circuitos' ordering = ['orden_circuito']
class Instrumentos_de_pago(models.Model): INSTRUMENTO = { ('TDC', 'Tarjeta de Credito'), ('TDD', 'Tarjeta de Debito'), ('ctabanco', 'Cuanta Bancaria'), ('zelle', 'Zelle'), } id_instrumento = models.AutoField(primary_key=True) doc_identidad_cliente = models.IntegerField() monto = models.IntegerField() tipo_instrumento = models.CharField(max_length=30, choices=INSTRUMENTO) id_banco = models.ForeignKey(Bancos, on_delete=models.PROTECT, related_name='id_banco_inst', null=True, blank=True, db_column='id_banco') numero_zelle = models.IntegerField(null=True, blank=True) email_zelle = models.EmailField(max_length=15, null=True, blank=True) persona = CompositeForeignKey( Clientes, on_delete=PROTECT, to_fields={'doc_identidad_o_rif': 'doc_identidad_cliente'}) def __str__(self): return 'id: ' + str(self.id_instrumento) + ' - ' + str( self.doc_identidad_cliente) class Meta: unique_together = [('id_instrumento', 'doc_identidad_cliente')] db_table = 'cgr_instrumentos_de_pago' ordering = ['id_instrumento']
class Auth(models.Model): org_code = models.CharField(max_length=45) org_dom = models.CharField(max_length=45) org_subdom = models.CharField(max_length=45) org_seq = models.IntegerField() auth = CompositeForeignKey( to=OrgSubdom, db_column='org_seq', related_name='auths', on_delete=models.CASCADE, to_fields={ 'org_code': 'org_code', 'org_dom': 'org_dom', 'org_subdom': 'org_subdom' }, ) question = models.CharField(max_length=255, blank=True, null=True) answer_type = models.CharField(max_length=15, blank=True, null=True) answer = models.CharField(max_length=500, blank=True, null=True) answer_hel_field = models.CharField(max_length=500, blank=True, null=True) created_by = models.CharField(max_length=45) created_datetime = models.DateTimeField() modified_by = models.CharField(max_length=45, blank=True, null=True) modified_datetime = models.DateTimeField(blank=True, null=True) class Meta: db_table = 'auth' unique_together = (('org_code', 'org_dom', 'org_subdom', 'org_seq'), ) def __str__(self): return 'Auth ' + str(self.question)
class Precios_paquetes(models.Model): f_inicio = models.DateField(primary_key=True) id_paquete = models.IntegerField() id_agencia = models.IntegerField() f_fin = models.DateField(null=True, blank=True) valor = models.IntegerField(null=True, blank=True) paquete = CompositeForeignKey(Paquetes, on_delete=PROTECT, to_fields={ 'id_paquete': 'id_paquete', 'id_agencia': 'id_agencia' }) def __str__(self): return self.f_inicio + '-' + str(self.id_paquete) + '-' + str( self.id_agencia) class Meta: unique_together = [('f_inicio', 'id_paquete', 'id_agencia')] db_table = 'cgr_precios_paquetes' ordering = ['f_inicio']
class Especializaciones(models.Model): id_especializacion = models.AutoField(primary_key=True) id_areas_de_interes = models.ForeignKey(Areas_de_interes, on_delete=models.PROTECT, related_name='id_area_es', db_column='id_areas_de_interes') id_atraccion = models.IntegerField() id_ciudad = models.IntegerField() id_pais = models.IntegerField() id_agencia = models.ForeignKey(Agencias_de_viajes, on_delete=models.PROTECT, null=False, related_name='id_agencia_es', db_column='id_agencia') id_paquete = models.IntegerField() id_agencia_paquete = models.IntegerField() id_asesor = models.ForeignKey(Asesores_de_viajes, on_delete=models.PROTECT, related_name='id_asesor_es', db_column='id_asesor') comentarios = models.TextField(max_length=255, null=True, blank=True) paquete = CompositeForeignKey(Paquetes, on_delete=PROTECT, to_fields={ 'id_paquete': 'id_paquete', 'id_agencia': 'id_agencia_paquete' }) lugar = CompositeForeignKey(Atracciones, on_delete=PROTECT, to_fields={ 'id_atraccion': 'id_atraccion', 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais' }) def __str__(self): return str(self.id_especializacion) + '-' + self.id_areas_de_interes class Meta: unique_together = [('id_areas_de_interes', 'id_especializacion')] db_table = 'cgr_especializaciones' ordering = ['id_especializacion']
class Contact(models.Model): company_code = models.IntegerField() customer_code = models.IntegerField() surname = models.CharField(max_length=255) # virtual field customer = CompositeForeignKey(Customer, on_delete=CASCADE, related_name='contacts', to_fields=OrderedDict([ ("company", "company_code"), ("customer_id", "customer_code"), ]))
class TempModel(models.Model): n = models.CharField(max_length=1) address = CompositeForeignKey(Address, on_delete=CASCADE, null=False, to_fields={ "tiers_id": "customer_id", "company": "company", "not_an_addrress_field": RawFieldValue("C") }, null_if_equal=[ # if either of the fields company or customer is -1, ther can't have address ("don'texists", 37), ])
class ITN_ATR(models.Model): id_itinerario = models.IntegerField(primary_key=True) id_ciudad = models.IntegerField() id_pais = models.IntegerField() id_agencia = models.IntegerField() id_paquete = models.IntegerField() id_atraccion = models.IntegerField() id_ciudad_at = models.IntegerField() id_pais_at = models.IntegerField() orden_visita = models.IntegerField() paquete = CompositeForeignKey(Itinerarios, on_delete=PROTECT, to_fields={ 'orden': 'id_itinerario', 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais', 'id_agencia': 'id_agencia', 'id_paquete': 'id_paquete' }) lugar = CompositeForeignKey(Atracciones, on_delete=PROTECT, to_fields={ 'id_atraccion': 'id_atraccion', 'id_pais': 'id_pais_at', 'id_ciudad': 'id_ciudad_at' }) def __str__(self): return str(self.id_itinerario) + '-' + str( self.id_agencia) + '-' + str(self.paquete) + '-' + str( self.id_atraccion) + '-' + str(self.id_ciudad) + '-' + str( self.id_pais) class Meta: unique_together = [ ('id_itinerario', 'id_ciudad', 'id_pais', 'id_agencia', 'id_paquete', 'id_atraccion', 'id_ciudad_at', 'id_pais_at') ] db_table = 'cgr_itn_atr' ordering = ['id_itinerario']
class FacDocument(models.Model): class Meta: ordering = ('dbkey', 'audit_year') indexes = [ models.Index(fields=('dbkey', 'audit_year')), ] version = models.IntegerField() audit_year = models.DecimalField( max_digits=4, decimal_places=0, help_text= 'Audit Year and DBKEY (database key) combined make up the primary key.' ) dbkey = models.CharField( max_length=6, help_text= 'Audit Year and DBKEY (database key) combined make up the primary key.' ) file_type = models.CharField(max_length=8, choices=( ('form', 'form'), ('audit', 'audit'), )) file_name = models.CharField( max_length=32) # <dbkey><audit-year><version>.<pdf | xlsx> # # These fields are available in the Scrapy-crawled results, but not # available if we refresh this table via an S3 ListBucket operation. # To support ListBucket refreshes, omit these fields. # # report_id = models.CharField(max_length=8) # ein = models.CharField( # max_length=9, # help_text='Employer Identification Number' # ) # fy_end_date = models.DateField() # fac_accepted_date = models.DateField() # date_received = models.DateField() # Map to General/Audit audit = CompositeForeignKey(Audit, on_delete=models.DO_NOTHING, to_fields={ 'audit_year': 'audit_year', 'dbkey': 'dbkey' }, related_name='documents') def __str__(self): return self.file_name def get_absolute_url(self): return os.path.join(settings.FAC_DOWNLOAD_ROOT, self.file_name)
class ATR_CIR(models.Model): id_atraccion = models.IntegerField(primary_key=True, unique=False) id_ciudad_at = models.IntegerField() id_pais_at = models.IntegerField() id_circuito = models.IntegerField() id_rally_cir = models.IntegerField() id_ciudad_cir = models.IntegerField() id_pais_cir = models.IntegerField() orden = models.IntegerField(null=True, blank=True) lugar = CompositeForeignKey(Atracciones, on_delete=PROTECT, to_fields={ 'id_atraccion': 'id_atraccion', 'id_ciudad': 'id_ciudad_at', 'id_pais': 'id_pais_at' }) recorrido = CompositeForeignKey(Circuitos, on_delete=PROTECT, to_fields={ 'orden_circuito': 'id_circuito', 'id_rally': 'id_rally_cir', 'id_ciudad': 'id_ciudad_cir', 'id_pais': 'id_pais_cir' }) def __str__(self): return str(self.id_atraccion) + str(self.id_ciudad_at) + str( self.id_pais_at) + str(self.id_circuito) + str( self.id_rally_cir) + str(self.id_ciudad_cir) + str( self.id_pais_cir) class Meta: unique_together = [ ('id_atraccion', 'id_ciudad_at', 'id_pais_at', 'id_circuito', 'id_rally_cir', 'id_ciudad_cir', 'id_pais_cir') ] db_table = 'cgr_atr_cir' ordering = ['id_atraccion']
class BadModelsFieldsOrder(models.Model): company = models.IntegerField() address = CompositeForeignKey(Address, on_delete=CASCADE, null=True, to_fields=OrderedDict([ ("company", "company"), ("tiers_id", "customer_id"), ("type_tiers", RawFieldValue("C")) ])) # problem : we set up the field after the compositeForeignKey that depend on him # in some cases, the default value of the customer_id will override the one # set up by the address field customer_id = models.IntegerField()
class Registro_viajeros(models.Model): id_agencia = models.IntegerField(primary_key=True, unique=False) id_viajero = models.IntegerField() f_registro = models.DateField() nro_registro = models.IntegerField() viajero = CompositeForeignKey(Viajeros, on_delete=PROTECT, to_fields={'id_de_identidad': 'id_viajero'}) agencia = CompositeForeignKey(Agencias_de_viajes, on_delete=PROTECT, to_fields={'id_agencia': 'id_agencia'}) def __str__(self): return self.id_agencia + ' ' + self.id_viajero class Meta: unique_together = [('id_viajero', 'id_agencia')] db_table = 'cgr_registro_viajeros' ordering = ['id_viajero']
class Paquetes_contrato(models.Model): numero_factura = models.AutoField(primary_key=True) id_paquete = models.IntegerField() id_agencia = models.IntegerField() id_reg_cliente = models.IntegerField() id_reg_agencia = models.IntegerField() id_asesor = models.ForeignKey(Asesores_de_viajes, on_delete=models.PROTECT, related_name='id_asesor_paq', null=True, blank=True, db_column='id_asesor') presupuesto = models.IntegerField() f_aprobacion = models.DateField() f_emision = models.DateField() email_validacion = models.EmailField(max_length=30) total_costo_calculado = models.IntegerField() numer_de_viajeros = models.IntegerField() f_viaje = models.DateField() registro = CompositeForeignKey(Registro_clientes, on_delete=PROTECT, to_fields={ 'id_cliente': 'id_reg_cliente', 'id_agencia': 'id_reg_agencia' }) paquete = CompositeForeignKey(Paquetes, on_delete=PROTECT, to_fields={ 'id_paquete': 'id_paquete', 'id_agencia': 'id_agencia' }) def __str__(self): return str(self.numero_factura) class Meta: db_table = 'cgr_paquetes_contrato' ordering = ['numero_factura']
class Supplier(models.Model): company = models.IntegerField() supplier_id = models.IntegerField() name = models.CharField(max_length=255) address = CompositeForeignKey(Address, on_delete=CASCADE, to_fields=OrderedDict([ ("company", LocalFieldValue("company")), ("tiers_id", "supplier_id"), ("type_tiers", RawFieldValue("S")) ])) class Meta(object): unique_together = [ ("company", "supplier_id"), ]
class PDFExtract(models.Model): """ PDF extract, per audit number. Attempt to extract as much data from the PDF as we can. """ class Meta: verbose_name_plural = 'PDF extracts' indexes = [ models.Index(fields=['audit_year', 'dbkey']), ] # Use these fields to link tables- 4 digits audit_year = models.DecimalField( max_digits=4, decimal_places=0, help_text= 'Audit Year and DBKEY (database key) combined make up the primary key.' ) # Use these fields to link tables- 1-6 digits dbkey = models.CharField( max_length=6, help_text= 'Audit Year and DBKEY (database key) combined make up the primary key.' ) # Map to General/Audit audit = CompositeForeignKey(Audit, on_delete=models.DO_NOTHING, to_fields={ 'audit_year': 'audit_year', 'dbkey': 'dbkey' }, related_name='pdf_extracts') finding_ref_nums = models.CharField(null=True, blank=True, max_length=100, help_text='Findings Reference Numbers') finding_text = models.JSONField(help_text='Extracted PDF finding') cap_text = models.JSONField( help_text='Extracted PDF corrective action plan') last_updated = models.DateField(help_text='Last Updated') def __str__(self): return f'PDF extract of {self.audit}: {self.finding_ref_nums}' def finding_to_dict(self): return json.loads(self.finding_text) def cap_to_dict(self): return json.loads(self.cap_text)
class Itinerarios(models.Model): orden = models.IntegerField(primary_key=True) id_ciudad = models.IntegerField() id_pais = models.IntegerField() id_agencia = models.IntegerField() id_paquete = models.IntegerField() tiempo_estadia = models.IntegerField() paquete = CompositeForeignKey(Paquetes, on_delete=models.PROTECT, to_fields={ 'id_paquete': 'id_paquete', 'id_agencia': 'id_agencia' }) lugar = CompositeForeignKey( Ciudades, on_delete=models.PROTECT, to_fields={ 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais' }, related_name='fk2_ciudades', ) def __str__(self): return str(self.orden) + '- ' + str(self.id_paquete) + '-' + str( self.id_agencia) + ' ' + str(self.id_ciudad) + ', ' + str( self.id_pais) class Meta: unique_together = [('orden', 'id_ciudad', 'id_pais', 'id_agencia', 'id_paquete')] db_table = 'cgr_itinerarios' ordering = ['orden']
class Alojamientos(models.Model): id_alojamiento = models.AutoField(primary_key=True) id_ciudad = models.IntegerField() id_pais = models.IntegerField() nombre = models.CharField(null=True, blank=True, max_length=30) lugar = CompositeForeignKey(Ciudades, on_delete=PROTECT, to_fields={ 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais' }) def __str__(self): return self.nombre class Meta: db_table = 'cgr_alojamientos' ordering = ['id_alojamiento']
class Detalles_servicios(models.Model): BOLETO = { ('boleto_avion', 'Boleto de avion'), ('boleto_tren', 'Boleto de tren'), ('boleto_autobus', 'Boleto de Autobus'), ('cama_alq', 'Cama de alquiler'), ('alojamiento', 'Alojamiento'), ('otro', 'otros'), } id_detalle_servicio = models.AutoField(primary_key=True) id_itinerario = models.IntegerField() id_paquete = models.IntegerField() id_agencia = models.IntegerField() id_ciudad = models.IntegerField() id_pais = models.IntegerField() tipo_detalle = models.CharField(max_length=30, choices=BOLETO) descripcion = models.CharField(max_length=255) comida = models.BooleanField(null=True, blank=True) paquete = CompositeForeignKey(Itinerarios, on_delete=PROTECT, to_fields={ 'orden': 'id_itinerario', 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais', 'id_agencia': 'id_agencia', 'id_paquete': 'id_paquete' }) def __str__(self): return str(self.id_detalle_servicio) + '-' + str( self.id_itinerario) + '-' + str(self.id_agencia) + '-' + str( self.paquete) + '-' + str(self.id_ciudad) + '-' + str( self.id_pais) class Meta: unique_together = [('id_itinerario', 'id_ciudad', 'id_pais', 'id_agencia', 'id_paquete', 'id_detalle_servicio')] db_table = 'cgr_detalles_servicios' ordering = ['id_detalle_servicio']
class FindingText(models.Model): class Meta: verbose_name_plural = 'finding text' indexes = [ models.Index(fields=['audit_year', 'dbkey']), ] seq_number = models.IntegerField( primary_key=True, help_text='Order that the findings text was reported' ) dbkey = models.CharField( max_length=6, help_text='Audit Year and DBKEY (database key) combined make up the primary key.' ) audit_year = models.DecimalField( max_digits=4, decimal_places=0, help_text='Audit Year and DBKEY (database key) combined make up the primary key.' ) # Map to General/Audit audit = CompositeForeignKey( Audit, on_delete=models.DO_NOTHING, to_fields={ 'audit_year': 'audit_year', 'dbkey': 'dbkey' }, related_name='finding_texts' ) finding_ref_nums = models.CharField( max_length=100, help_text='Audit Finding Reference Number' ) text = models.TextField( help_text='Content of the finding text' ) charts_tables = models.BooleanField( help_text='Indicates whether or not the text contained charts or tables that could not be entered due to formatting restrictions' )
class Cupos(models.Model): id_agencia = models.IntegerField(primary_key=True) id_rally = models.ForeignKey(Rallies, on_delete=models.PROTECT, related_name='id_rally_cupos', db_column='id_rally') cantidad = models.IntegerField(null=True, blank=True) agencia = CompositeForeignKey(Agencias_de_viajes, on_delete=PROTECT, to_fields={'id_agencia': 'id_agencia'}) def __str__(self): return 'A: ' + self.id_agencia + ', ' + 'R: ' + self.id_rally class Meta: unique_together = [('id_agencia', 'id_rally')] db_table = 'cgr_cupos' ordering = ['id_agencia']
class PAI_VIA(models.Model): id_viajero = models.IntegerField(primary_key=True) id_pais = models.ForeignKey(Paises, on_delete=models.PROTECT, related_name='id_pais_via', db_column='id_pais') nro_de_pasaporte = models.IntegerField() viajero = CompositeForeignKey(Viajeros, on_delete=PROTECT, to_fields={'id_de_identidad': 'id_viajero'}) def __str__(self): return self.id_viajero + ' ' + self.id_pais class Meta: unique_together = [('id_viajero', 'id_pais')] db_table = 'cgr_pai_via' ordering = ['id_viajero']
class AGE_AGE(models.Model): id_agencia = models.IntegerField(primary_key=True) id_socio = models.IntegerField() f_inicio = models.DateField() f_fin = models.DateField(null=True, blank=True) colegas = CompositeForeignKey(Agencias_de_viajes, on_delete=PROTECT, to_fields={ 'id_agencia': 'id_agencia', 'id_agencia': 'id_socio' }) def __str__(self): return 'a: ' + self.id_agencia + ', ' + 's: ' + self.id_socio class Meta: unique_together = [('id_agencia', 'id_socio')] db_table = 'cgr_age_age' ordering = ['id_agencia']
class PRO_AGE(models.Model): id_agencia = models.IntegerField(primary_key=True) id_proveedor = models.ForeignKey(Proveedores, on_delete=models.PROTECT, related_name='id_proveedor_PA', db_column='id_proveedor') f_inicio = models.DateField() f_fin = models.DateField(null=True, blank=True) agencia = CompositeForeignKey(Agencias_de_viajes, on_delete=PROTECT, to_fields={'id_agencia': 'id_agencia'}) def __str__(self): return 'A: ' + self.id_agencia + ', ' + 'P: ' + self.id_proveedor class Meta: unique_together = [('id_agencia', 'id_proveedor')] db_table = 'cgr_pro_age' ordering = ['id_agencia']
class ALO_DET(models.Model): id_detalle_servicio = models.IntegerField(primary_key=True) id_itinerario = models.IntegerField() id_paquete = models.IntegerField() id_agencia = models.IntegerField() id_ciudad = models.IntegerField() id_pais = models.IntegerField() id_alojamiento = models.ForeignKey(Alojamientos, on_delete=models.PROTECT, related_name='id_clientes_ALO', db_column='id_alojamiento') detalle = CompositeForeignKey(Detalles_servicios, on_delete=PROTECT, to_fields={ 'id_detalle_servicio': 'id_detalle_servicio', 'id_itinerario': 'id_itinerario', 'id_ciudad': 'id_ciudad', 'id_pais': 'id_pais', 'id_agencia': 'id_agencia', 'id_paquete': 'id_paquete' }) def __str__(self): return str(self.id_detalle_servicio) + '-' + str( self.id_itinerario) + '-' + str(self.id_agencia) + '-' + str( self.paquete) + '-' + str(self.id_ciudad) + '-' + str( self.id_pais) + '-' + str(self.id_alojamiento) class Meta: unique_together = [ ('id_itinerario', 'id_ciudad', 'id_pais', 'id_agencia', 'id_paquete', 'id_alojamiento', 'id_detalle_servicio') ] db_table = 'cgr_alo_det' ordering = ['id_detalle_servicio']
class SupplierTranslations(models.Model): master = models.ForeignKey( MultiLangSupplier, on_delete=CASCADE, related_name='translations', null=True, ) language_code = models.CharField( max_length=255, choices=global_settings.LANGUAGES, ) name = models.CharField(max_length=255) title = models.CharField(max_length=255) class Meta: unique_together = ('language_code', 'master') active_translations = CompositeForeignKey( SupplierTranslations, on_delete=DO_NOTHING, to_fields={ 'master_id': 'id', 'language_code': FunctionBasedFieldValue(get_language) }) active_translations.contribute_to_class(MultiLangSupplier, 'active_translations')