Userena:如何获取“编辑个人资料”中的字段保存 [英] Userena: How can I get the fields in "edit profile" to save

查看:109
本文介绍了Userena:如何获取“编辑个人资料”中的字段保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用户已经在userena成功注册了。查看配置文件时,正确显示注册过程中输入的信息。我点击编辑个人资料,并提交表单。然后我注意到这个行为:


  1. 查看个人资料(数据正确)

  2. 编辑个人资料,然后点击

  3. 查看个人资料(新保存的信息已经消失)

  4. 编辑个人资料,只填写在最喜欢的小吃字段中(重定向到查看配置文件页面,显示最喜欢的小吃)

  5. 该配置文件现在正常运行,可以像普通的一样进行编辑和保存。

为什么编辑个人资料页面的正常功能取决于我是否填写了最爱小吃字段?请注意,最喜欢的零食在models.py中定义,如 userena教程



任何想法?

解决方案

我发现问题。看起来我可以允许一个空白字段进行以下更改。



旧代码

  favourite_snack = models.CharField(_('favorite snack'),
max_length = 5)

新代码

  favourite_snack = models.CharField(_('favorite snack'),
max_length = 5,blank = True)


I have a user I have successfully registered in userena. When I view the profile, the information entered in during signup is properly displayed. I click "edit profile" and am presented with the form. I then noticed this behavior:

  1. View profile (data is correct)
  2. Edit profile then click save (redirected to the same form with all information still filled in)
  3. View profile (newly saved information is gone)
  4. Edit profile and only fill in the "favorite snack" field (redirected to the "view profile" page with the "favorite snack" now showing)
  5. The profile now behaves normally and can be edited and saved like normal.

Why is the proper functioning of the edit profile page dependent on whether I have the "favorite snack" field filled in? Note that "favorite snack" is defined in models.py as outlined in the userena tutorial.

Any ideas?

解决方案

I found the problem. It looks like I can allow for a blank field with the following change.

Old Code:

favourite_snack = models.CharField(_('favourite snack'),
                                   max_length=5)

New Code:

favourite_snack = models.CharField(_('favourite snack'),
                                   max_length=5, blank=True)

这篇关于Userena:如何获取“编辑个人资料”中的字段保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆