-1
I have to create models based on the following UML:
I actually made the code of Experience that way:
class Experiencia(Base):
ACADEMICA = 'AC'
PROFISSIONAL = 'PR'
TIPO_CHOICES = [
(ACADEMICA, 'Acadêmica'),
(PROFISSIONAL, 'Profissional'),
]
candidato = models.ForeignKey(Candidato, on_delete=models.CASCADE)
tipo = models.CharField(choices=TIPO_CHOICES, max_length=50)
data_inicio = models.DateField()
data_fim = models.DateField()
observacao = models.TextField(max_length=400)
I am in doubt on how to place the objects of Academica
and of Profissional
in choices
, because what you currently have are just the strings. The question to Tipo_curso
, how to place it to be a Academica
. And if there was any way to use polymorphism in that.
You are thinking of: I want to record 'Academic Experience' or 'Professional Experience' or use the relation 'many for many' (Academic and Professional) the same is in the diagram?
– Carlos Cortez
@Carloscortez Each experience can be just one: Academic or professional. And in another class I have a field that can have several experiences. What I want to know is how to implement for Experience Option reference professional or academic. That is, when I indicate that the experience is academic, how will I know this data? Ex: institution, course. I have the same question for Academica and Tipocurso.
– Leonardo Furtado
I confess q would also like to know how to make this dynamic change using only python/Django. What I have come across is manipulation via Java script in the Forms/views, never directly in the models and in the administrative area. I will try to overwrite the templates and if I get anything, I publish
– Carlos Cortez