RelatedObjectDoesNotExist: User has no userprofile

后端 未结 7 1098
旧巷少年郎
旧巷少年郎 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:40

    Just try to create a new user using shell to get access to the admin page then create a profile from admin page for the old user : python manage.py createsuperuser

    To access to shell, inside your directory project ine terminall type : python manage.py shell

提交回复
热议问题