The problem is, I have to give foreign key reference to two different models so as to record the activity logs of the user
I have model named Activity Log to record the activities done by the user
class ActivityLog(models.Model):
target = models.ForeignKey(Build, on_delete=models.CASCADE, null=True, blank=True)
# Target, (Optional) The object to which the activity was performed.
user = models.ForeignKey(User, on_delete=models.CASCADE)
# Actor The object that performed the activity.
action_object = models.ForeignKey(Team, on_delete=models.CASCADE, null=True, blank=True)
# Action Object. (Optional) The object linked to the action itself.
content = models.TextField()
# Content of the activity
timestamp = models.DateTimeField()
I need to give the target field with foreign key refering to two different models. Is it possible to use generic relations?