I have many different models with different types of fields. I want to use foreign key for multiple models. Like:
class Model1(models.Model):
title = models.TextField()
body = models.TextField()
class Model2(models.Model):
tag = models.CharField(max_length=200)
uploadedDate = models.DateTimeField(auto_now_add=True)
class MainModel(models.Model):
content = models.ForeignKey([Model1, Model2], on_delete=models.CASCADE) # this will give error
How can I do this?