Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocumentForm save error: object has no attribute 'cleaned_data' #66

Open
denger opened this issue Jun 10, 2014 · 0 comments
Open

DocumentForm save error: object has no attribute 'cleaned_data' #66

denger opened this issue Jun 10, 2014 · 0 comments

Comments

@denger
Copy link

denger commented Jun 10, 2014

pip freeze

(deco_env)➜ speechtv pip freeze
Django==1.4.2
mongodbforms==0.3
mongoengine==0.8.3
pymongo==2.7.1

Form
class SpeechTVForm(DocumentForm):
    class Meta:
        document = SpeechTV
        fields = ['source_link', 'embed', 'share_author']
SpeechTV Document
class SpeechTV(Document):
    title = StringField(max_length=30)
    source_link = StringField()
    embed = StringField()
    intro = StringField()
    share_author = StringField()
    ...more...
view.py
def share(request):
    if request.method == 'POST':
        form = SpeechTVForm(request.POST) 
        form.save()
when i post form, show this error message:

Request Method: POST
Request URL: http://127.0.0.1:8000/submit_speech.tv
Django Version: 1.4.2
Python Executable: /Users/denger/Workspaces/Works/deco_workspace/deco_env/bin/python
Python Version: 2.7.3
Python Path: ['/Users/denger/Dropbox/Codes/speechtv',/Users/denger/Workspaces/Works/deco_workspace/deco_env/lib/python2.7/site-packages/PIL']
Installed Applications:

Traceback:
File "/Users/denger/Workspaces/Works/deco_workspace/deco_env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111 . response = callback(request, _callback_args, *_callback_kwargs)
File "/Users/denger/Dropbox/Codes/speechtv/speechtv/views.py" in share
26 . form.save()
File "/Users/denger/Workspaces/Works/deco_workspace/deco_env/lib/python2.7/site-packages/mongodbforms/documents.py" in save
533 . fail_message, commit, construct=False)
File "/Users/denger/Workspaces/Works/deco_workspace/deco_env/lib/python2.7/site-packages/mongodbforms/documents.py" in save_instance
178 . instance = construct_instance(form, instance, fields, exclude)
File "/Users/denger/Workspaces/Works/deco_workspace/deco_env/lib/python2.7/site-packages/mongodbforms/documents.py" in construct_instance
98 . cleaned_data = form.cleaned_data

Exception Type: AttributeError at /submit_speech.tv
Exception Value: 'SpeechTVForm' object has no attribute 'cleaned_data'
Request information:
GET: No GET data

POST:
source_link = u'sfasfsafsafasf'
csrfmiddlewaretoken = u'ppHzHO8TREgHfKBGobdk7UlW7OvFnICA'
embed = u'afsdfasfasd'
share_author = u'afd'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant