related_name设置为+或者以+结尾即可
If you'd prefer Django not to create a backwards relation, set related_name
to '+'
or end it with '+'
. For example, this will ensure that the User
model won't have a backwards relation to this model:
user = models.ForeignKey( User, on_delete=models.CASCADE, related_name='+',)
转载于:https://blog.51cto.com/wenguonideshou/2155082