1class MyModel(models.Model):
2 ...other fields...
3 content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.SET_NULL)
4 object_id = models.PositiveIntegerField(blank=True, null=True)
5 content_object = generic.GenericForeignKey('content_type', 'object_id')