RelatedObjectDoesNotExist: User has no userprofile

后端 未结 7 1035
旧巷少年郎
旧巷少年郎 2020-12-28 17:58

So I\'ve extended my user with the field score like this:

models.py:

class UserProfile(models.Model):
    user = models.OneToOneField(Us         


        
7条回答
  •  有刺的猬
    2020-12-28 18:49

    First Register profile model in admin.py if not already done.

    Create new superuser using ./manage.py createsuperuser.

    Log in with new superuser.

    From Admin panel click Profile and add new entry and selct user from user dropdown and save.

提交回复
热议问题