2
is the following created 3 models, one is the Person, another is the aggressor and the other is Life . Being that Aggressor inherits from person (I have already done the inheritance). And the class Life can have an object of the type Aggressor. How do I make this relationship Do I use Foreignkey? And to make it reflect when 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)