在第一个版本中,我们可以为 ManyToManyField 使用自定义表,参数 through=MyModel。MyModel 应该包含外键。但我想使用通用外键:
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
内容对象作为外键。
我该怎么做?