is the following I created 3 models, one is the Person, another is aggressor and the other is Life . Being that Agressor inherits of person (I have made the inheritance). And the Life class can have an Aggressor-type object. How do I make this relationship Do I use ForeignKey? And to make this reflect at the time of creating the template, type to enter the values (input) of the created object?
class ForensicPessoa(models.Model):
name = models.CharField(max_length=100, blank=True, null=True, verbose_name='Nome')
birth = models.DateTimeField(blank=True, null=True, verbose_name='Data de Nascimento')
rg = models.CharField(max_length=25, blank=True, null=True, verbose_name='RG')
class ForensicAgressor(ForensicPessoa):
stature = models.DecimalField(max_digits=20, decimal_places=6, blank=True, null=True, verbose_name='Estatura')
color_hair = models.CharField(max_length=100, blank=True, null=True, verbose_name='Cor do cabelo')
class ForensicVida(models.Model):
agressor = models.ForeignKey(ForensicAgressor)
belongings_victim_lf = models.CharField(max_length=100, blank=True, null=True, verbose_name='Pertences')
How do I access the attributes of the attacker (object) in the template?
{{ form_vida.agressor.name }} ->agressor (objeto criado class ForensicVida)