-1
def is_valid(self):
form = super(UserCreateForm, self).is_valid()
for f, error in self.errors.iteritems():
if f != '__all_':
self.fields[f].widget.attrs.update({'class': 'error', 'value': strip_tags(error)})
return form
回溯
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
114. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/saurabh/Desktop/project/ribbit/ribbit_app/views.py" in signup
48. if user_form.is_valid():
File "/home/saurabh/Desktop/project/ribbit/ribbit_app/forms.py" in is_valid
18. self.fields[f].widget.attrs.update({'class': 'error', 'value': strip_tags(error)})
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in wrapper
203. return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/utils/html.py" in strip_tags
134. s.feed(value)
File "/usr/lib/python2.7/HTMLParser.py" in feed
113. self.rawdata = self.rawdata + data
Exception Type: TypeError at /signup
Exception Value: cannot concatenate 'str' and 'ErrorList' objects
什麼這樣的背景下? – Zulu