Hi all, I´ve developed that model, but i´m quite confused about the sintax,
looks a bit freaky... Hers my code:
from django.db import models
##################################
#### PROJETOS ####
##################################
class Projetos(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
i_motivo_oferta = models.IntegerField()
s_nome_projeto = models.CharField("Projeto",max_length=100)
s_integrador = models.CharField("Integrador",max_length=100)
s_contend_provider = models.CharField("Contend
Provider",max_length=100)
s_marca_servico = models.CharField("Marca do
Serviço",max_length=100)
ABRANGENCIA = (('R', 'Regional'),('N', 'Nacional'),)
s_abrangencia = models.CharField("Abrangência",max_length=2,
choices=ABRANGENCIA)
TIPO_SERVICO = (('C', 'Cross'),('W', 'White Label'),)
i_id_tipo_servico = models.CharField("Tipo de
Serviço",max_length=2, choices=TIPO_SERVICO)
i_valor_retry = models.IntegerField("Valor de retry")
i_la = models.IntegerField("Large account")
d_lanc_comercial = models.DateField("Lançamento comercial")
d_term_projeto = models.DateField("Término do projeto")
???????????????????????????????????????
??? PLANOS_DE_MIDIA = (('I', 'Internet'), ('T', 'TV'), ('R',
'Radio'), ('R', 'Revista'), ('R', 'Midia Exterior'), ('R', 'Outros'),)
??? i_plan_midia = models.CharField("Plano de midia",max_length=2,
choices=PLANOS_DE_MIDIA)
???????????????????????????????????????
d_data_acordo = models.DateField("Data de Acordo")
d_data_revisao = models.DateField("Data de Revisão")
i_ura_id = models.IntegerField("URA ID")
s_ura_desc = models.CharField("Descição URA",max_length=200)
#FOREIGN KEY "Perfil_Servico"
i_id_perfil_servico = models.ForeignKey(Perfil_Servico)
###################################################
#### RELAÇÕES N -> 1 COM A TABELA PROJETOS #####
###################################################
# Para cada "PROJETO" eu tenho varios Header Enrichment #
class Header_Enrich(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_url = models.URLField("Url")
b_wap = models.BooleanField("Wap")
b_web = models.BooleanField("Web")
#FOREIGN KEY "Projetos"
i_id_projetos = models.ForeignKey(Projetos)
# Para cada "PROJETO" eu tenho varias estimativas de trafego/receita
para cada mes do ano. #
class Traf_Receita(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
i_mes = models.IntegerField("Mês")
i_ano = models.IntegerField("Ano")
i_trafego = models.IntegerField("Trafego")
i_receita = models.IntegerField("Receita")
#FOREIGN KEY "Projetos"
i_id_projetos = models.ForeignKey(Projetos)
# Para cada "PROJETO" eu tenho varias tarifas e descrições. #
class Tarifar_Proj(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
i_tarifa_proj = models.IntegerField("Tarifa")
s_desc_tarifa = models.CharField("Descrição da tarifa",
max_length=200)
#FOREIGN KEY "Projetos"
i_id_projetos = models.ForeignKey(Projetos)
# Para cada "PROJETO" eu tenho varios planejamentos de midia. #
class Planej_Midia(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_planej_midea = models.CharField("Planejamento de midia",
max_length=200)
s_desc_midea = models.CharField("Descrição", max_length=200)
#FOREIGN KEY "Projetos"
i_id_projetos = models.ForeignKey(Projetos)
#######################
### TABELAS FATO ###
#######################
"""
# Relaciona Projeto com Tipo de Servico
class Rel_Proj_Tipo_Servico(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FOREIGN KEY "Projetos" && "Motivo_Oferta"
i_id_projetos = models.ForeignKey(Projetos)
i_id_tipo_servico = models.ForeignKey(Tipo_Servico)
"""
# Relaciona Projeto com motivo da oferta
class Rel_Proj_Motivo(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FOREIGN KEY "Projetos" && "Motivo_Oferta"
i_id_projetos = models.ForeignKey(Projetos)
i_id_motivo_oferta = models.ForeignKey(Motivo_Oferta)
###################################################
#### RELAÇÕES N -> 1 COM Rel_Proj_Motivo #####
###################################################
class Motivo_Oferta(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_desc_motivo_oferta = models.CharField("Descrição motivo da
ofera", max_length=200)
#########################################################
#### RELAÇÕES N -> 1 COM Rel_Proj_Tipo_Servico #####
#########################################################
"""
class Tipo_Servico(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_desc_tipo_servico = models.CharField(max_length=200)
"""
####################################################################################
########################### PERFIL DO SERVICO
###############################
####################################################################################
class Perfil_Servico(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_csp_desc = models.CharField("CSP id",max_length=200)
###################################################
#### RELAÇÕES N -> 1 COM PERFIL DO SERVICO #####
###################################################
class Relatorio_Dw(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_grupo = models.CharField("Grupo", max_length=100)
s_servico = models.CharField(max_length=100)
s_fornecedor = models.CharField(max_length=100)
s_aplicacao = models.CharField(max_length=100)
i_qtd_ass_diarias = models.IntegerField()
i_qtd_evt = models.IntegerField()
i_qtd_msg_saintes = models.IntegerField()
i_qtd_download_ativ = models.IntegerField()
i_qtd_pacotes = models.IntegerField()
#FOREIGN KEY "Perfil_Servico"
i_id_perfil_serviço = models.ForeignKey(Perfil_Servico)
class Sintaxe_Sms(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_servico = models.CharField(max_length=100)
s_nome_canal = models.CharField(max_length=100)
s_cmd_ativ_canal = models.CharField(max_length=100)
s_div_midia = models.CharField(max_length=100)
s_md_desv_canal = models.CharField(max_length=100)
s_cmd_rec_ultimo = models.CharField(max_length=100)
s_freq_cat = models.CharField(max_length=100)
#FOREIGN KEY "Perfil_Servico"
i_id_perfil_serviço = models.ForeignKey(Perfil_Servico)
class Dados_Sdp_Interatividade(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_interatividade = models.CharField(max_length=100)
#FOREIGN KEY "Perfil_Servico"
i_id_perfil_serviço = models.ForeignKey(Perfil_Servico)
class Dados_Sdp_Sub_Osp(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_servico =
i_sender_mt_conteudo =
#FOREIGN KEY "Perfil_Servico"
i_id_perfil_serviço = models.ForeignKey(Perfil_Servico)
class Dados_Canais_Sms_Sub(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_servico = models.CharField(max_length=100)
s_mod_recebimento = models.CharField(max_length=100)
#FOREIGN KEY "Perfil_Servico"
i_id_perfil_serviço = models.ForeignKey(Perfil_Servico)
###################################################
#### RELAÇÕES 1 -> 1 COM PERFIL DO SERVICO #####
###################################################
class Vias_Solicitacao(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
s_sms_teste = models.CharField(max_length=60)
s_sms_prod = models.CharField(max_length=60)
s_mms_teste = models.CharField(max_length=60)
s_mms_prod = models.CharField(max_length=60)
s_web_teste = models.CharField(max_length=60)
s_web_prod = models.CharField(max_length=60)
s_wap_teste = models.CharField(max_length=60)
s_wap_prod = models.CharField(max_length=60)
s_ura_teste = models.CharField(max_length=60)
s_ura_prod = models.CharField(max_length=60)
u_url_crc = models.URLField()
i_id_perfil_servico = models.OneToOneField(Perfil_Servico)
class Estimativa_Trafego(models.Model):
PERIODO = (
('D', 'Diario'),
('M', 'Mensal'),
)
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
i_vol_med = models.IntegerField()
i_vol_med_periodo = models.CharField(max_length=2, choices=PERIODO)
i_vol_pico = models.IntegerField()
i_vol_pico_periodo = models.CharField(max_length=2,
choices=PERIODO)
i_id_perfil_servico = models.OneToOneField(Perfil_Servico)
###################################################
#### RELAÇÕES N -> 1 com Estimativa Trafego ####
###################################################
class Hora_Pico(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
i_hora_inicio = models.IntegerField()
i_hora_fim = models.IntegerField()
b_hora_pico_col = models.BooleanField
#FOREIGN KEY "Perfil_Servico"
i_id_estimativa_trafego = models.ForeignKey(Estimativa_Trafego)
###################################################
#### RELAÇÕES N -> 1 com: ####
#### -Dados_Sdp_Interatividade ####
#### -Dados_Canais_Sms_Sub ####
#### -Dados_Sdp_Sub_Osp ####
###################################################
class Tripleta(models.Model):
#PRIMARY KEY
i_id = models.AutoField(primary_key=True)
#FIELDS
i_ser1 = models.IntegerField()
i_ser2 = models.IntegerField()
i_ser_3 = models.IntegerField()
i_preco = models.IntegerField()
s_desc_fatura = models.CharField(max_length=200)
#FOREIGN KEY "Perfil_Servico"
i_id_dados_sdp_interatividade =
models.ForeignKey(Dados_Sdp_Interatividade)
i_id_dados_sdp_sub_osp = models.ForeignKey(Dados_Sdp_Sub_Osp)
i_id_dados_canais_sms_sub = models.ForeignKey(Dados_Canais_Sms_Sub)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/_7o9KoJNln8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.