Answers for "django genericforeignkey null"

1

django genericforeignkey null

class MyModel(models.Model):
    ...other fields...
    content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.SET_NULL)
    object_id = models.PositiveIntegerField(blank=True, null=True)
    content_object = generic.GenericForeignKey('content_type', 'object_id')
Posted by: Guest on September-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language