django userena中的额外字段无法从表单中检索值

django userena中的额外字段无法从表单中检索值,django,Django,正在尝试为我的一个项目使用django userena。但在检索其中一个表单字段的值时遇到问题 我的表单如下所示(与演示几乎相同,只添加了phone字段): 现在,当我填写注册表单中的字段并单击“提交”时,我发现以下错误: Traceback: File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response 115. response = callback(request, *c

正在尝试为我的一个项目使用
django userena
。但在检索其中一个表单字段的值时遇到问题

我的表单如下所示(与演示几乎相同,只添加了
phone
字段):

现在,当我填写注册表单中的字段并单击“提交”时,我发现以下错误:

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/userena/decorators.py" in _wrapped_view
28. return view_func(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/userena/views.py" in signup
119. user = form.save()
File "/home/qwerty/dev/projects/qqq/accounts/forms.py" in save
50. user_profile.phone_number = self.cleaned_data['phone'] # problem is here

Exception Type: KeyError at /accounts/signup/
Exception Value: 'phone'

奇怪的是,
self.cleaned_data['phone']
总是空的,即使我输入了数据,但是访问
last_name
first_name
没有问题。我找不到任何解决问题的方法,如果有人能告诉我正确的路径,我将不胜感激。

通过执行
self.fields.keyOrder[:-2]
您实际上忽略了最后两个字段。你不应该把清单切成薄片

new_order = self.fields.keyOrder

通过执行
self.fields.keyOrder[:-2]
您实际上忽略了最后两个字段。你不应该在名单上分片。谢谢阿米尔,你的建议解决了我的问题。如果您将此添加为答案,我将选择它作为“已选”。作为答案发布;-)我刚刚删除了
\uuuu init\uuu
方法。
new_order = self.fields.keyOrder