FK関係をトラバースする方法と同様に、Djangoテンプレートで一般的な関係をトラバースしたいと思います。
Models.py
class Company(models.Model):
name = models.CharField(blank=True, max_length=100)
notes = models.TextField(blank=True)
class Address(models.Model):
address = models.TextField(max_length=200)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
これは私のテンプレートでは機能しないようです:
{{ company.address_set.all }}
どんな助けでも大歓迎です。