Creating a profile model with both an InlineAdmin and a post_save signal in Django

后端 未结 2 653
猫巷女王i
猫巷女王i 2021-01-02 04:30

I created a \'profile\' model (with a 1-to-1 relationship to the User model) as described on Extending the existing user model. The profile model has an optional many-to-one

2条回答
  •  无人及你
    2021-01-02 04:45

    It seems like setting primary_key=True on the OneToOneField connecting the profile model to the User model fixes this issue. However, I don't think I understand all the implications of that and why it helps.

    I'll leave this here as a hint, but if that's the best solution and someone could come up with a well-written explanation, I'd upvote/accept that and possibly delete mine.

提交回复
热议问题