Hello, I'm starting to study about python because of Django. I have a doubt that many may consider trivial but I do not know the answer.
I'm building a Template with the following features:
class Candidato(models.Model):
nome = models.CharField(max_length=300, required=True)
mail = models.EmailField(max_length=300, required=True)
fone = models.CharField(max_length=20, required=True)
nascimento = models.DateTimeField(blank=False, null=False)
cpf = models.CharField(max_length=50, required=True)
rg = models.CharField(max_length=50, required=True)
trabalho = models.EmailField(max_length=300, required=True)
mae = ???????????
pai = ???????????
I need the fields "mother" and "father" to be two objects with the following structure:
class Mae(models.Model):
nome = models.CharField(max_length=300, required=True)
nascimento = models.DateTimeField(blank=False, null=False, required=True)
cpf = models.CharField(max_length=50, required=True)
rg = models.CharField(max_length=50, required=True)
mail = models.EmailField(max_length=300, required=True)
fone = models.CharField(max_length=20, required=True)
trabalho = models.EmailField(max_length=300, required=True)
class Pai(models.Model):
nome = models.CharField(max_length=300, required=True)
nascimento = models.DateTimeField(blank=False, null=False, required=True)
cpf = models.CharField(max_length=50, required=True)
rg = models.CharField(max_length=50, required=True)
email = models.EmailField(max_length=300, required=True)
fone = models.CharField(max_length=20, required=True)
trabalho = models.EmailField(max_length=300, required=True)
membro = models.BooleanField()
How do I reference a "Parent" object and a "Mae" within the "Candidate" object?
Thank you in advance for the help of anyone who can help me.