django-rest-auth 编码 email/username

django-rest-auth encoding email/username

我 运行 正在更新 django-rest-auth 库中的扩展用户配置文件 (这里是图书馆 http://django-rest-auth.readthedocs.io/en/latest/introduction.html

我用 UserProfile 扩展了用户:

    class UserProfile(models.Model):
       user = models.OneToOneField(User, primary_key=True, 
              on_delete=models.CASCADE, related_name='userprofile') 
       platformLanguage = models.TextField(null=True)
       mentorApprovalRequest = models.BooleanField(default=False)
       approvedAsMentor = models.BooleanField(default=False)
       fullName = models.TextField(null=True)
       dateOfBirth = models.DateField(null=True)
       placeOfBirth = models.TextField(null=True)
       bio = models.TextField(null=True)

基本上我正在创建由(用户名、电子邮件、密码)组成的初始用户,请参阅附件图片:Registration of User

然后我尝试更新userProfile的信息,更新请看图片:Userprofile Update

我们开始吧,当我尝试更新时它说 "Not found",但用户已注册。然后当我查看电子邮件解码而不是 admin@gmail.com 时,我有错误的电子邮件解码 admin%40gmail.com,我想这可能是我无法更新用户配置文件详细信息的问题.

根据提供的 urls.py,问题似乎出在 URL,信息被发送到:默认情况下,视图集将形成 URL 和 pk参数,这是增量 Django 数据库 ID,因此 URL 可能看起来像 /userprofiles/<pk>/,其中 pk 是数字用户或 UserProfile ID(取决于视图集使用的模型)电子邮件 slug。