related_name argument not working as expected in Django model?

前端 未结 2 1078
一向
一向 2021-02-01 03:24

I recently got a ForeignKey clash in my Django model. I have the need to have two foreign keys (owner, assigned_to) ultimately pointing to the same model (a user).

From

2条回答
  •  Happy的楠姐
    2021-02-01 03:31

    If you are using related_name in abstract base class you need to use a '%(app_label)s' and '%(class)s' in it. Its mentioned in django doc

    Be careful with related_name

提交回复
热议问题