My Training model has a "titles" attribute ( cargos = models.ManyToManyField(Cargo, verbose_name="cargos")
), and the Person model has a "title" attribute.
I want to search for all the training sessions scheduled for that person
To see if I'm correct:
persona_r = Persona.objects.get(id=idPersona)
capacitaciones_r = Capacitacion.objects.filter(cargos__id=persona_r.cargo)
To obtain the training related to a serious position:
You can see the official documentation