Create OneToOne instance on model creation

前端 未结 3 2069
孤街浪徒
孤街浪徒 2020-12-13 14:50

I\'m building my first django app. I have a user, and the user has a list of favourites. A user has exactly one list of favourites, and that list belongs exclusively to that

3条回答
  •  执笔经年
    2020-12-13 15:37

    An excellent django-annoying plugin solves this for you with AutoOneToOneField. I'm using it for user profiles in all django projects I work on.

提交回复
热议问题