I have one model in my project.
class users(models.Model):
match_user = models.ForeignKey(User,on_delete=models.CASCADE)
matched_user = models.CharField(max_length=25)
Imagine that: match_user is 'Mete' and matched_user is 'Gizem'. Also match_user is 'Gizem' and matched_user is 'Mete' I have 2 table line:
id match_user matched_user
__ __________ ____________
1 mete gizem
2 gizem mete
Now if ı want delete mete, only first row deleted. But I want to delete 2 rows.Actually I want to two foreign key about same location in different table. How I can? is it possible. İf it is not a possible, is there any solution for my want. Also I tried some different ways like that:
match_user = models.ForeignKey(User,related_name="username"on_delete=models.CASCADE)`
matched_user = models.ForeignKey(User,related_name="username",on_delete=models.CASCADE)`
But there is error all time Thanks for answers :)