Does changing a django models related_name attribute require a south migration?

后端 未结 2 1125
情歌与酒
情歌与酒 2021-02-13 07:04

I have a simple django model with a ForeignKey

class FooModel(models.Model):
    foo = models.ForeignKey(\'Foo\', related_name=\"foo_choices\")
    bar = models.         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-13 07:37

    No You do not need a migration.

    Related name is the name to use for the relation from the related object back to this one (the reverse relationship).

    related_name has nothing to do with the database. It is consumed by the Django's ORM to fetch queryset results, so you dont need a migration if you change the related_name attribute on a models' field.

    Some additional documentation here on the usage of related_name

提交回复
热议问题