Sunday, January 30, 2011

Re: simplest for example, Error object has no attribute 'cleaned_data'

On Sunday, January 30, 2011 8:02:08 AM UTC, gintare wrote:
Is it possible by making small change to resolve the error below:
(I did not yet finished reading all manual, maybe the error disappears
if i make custom code for every line in the model, but my model has
over 30 fields thus i would like to have automated save and post of
all these fields)

Django Version: 1.2.4
Exception Type: AttributeError
Exception Value: 'WordFormM' object has no attribute 'cleaned_data'
Exception Location: c:\Python27\lib\site-packages\django\forms
\ in save_m2m, line 78
from forms import FindWordM
from models import Word
from django.shortcuts import render_to_response,

def first(request):
    return render_to_response("c:/Python27/Scripts/Finnish2/Fin/
templates/trials/correct.html", {
        "formWord": formWord})
from django.forms import ModelForm
from models import Word

class FindWordM(ModelForm):
    class Meta:
from django.db import models

class Word(models.Model):
    WordSentencesMM=models.ManyToManyField('self', null=True,
related_name='DeclNWord', null=True, blank=True)
from django.conf.urls.defaults import *

urlpatterns = patterns('',

It's not very likely to encourage people to help you if you admit you haven't read the documentation.

What exactly are you trying to do here? You instantiate a form from an instance, and immediately try and save it, without even passing in values from the POST. Why? In any case, the error is that forms don't have a cleaned_data attribute until you call is_valid() on them, which the documentation does clearly state. The documentation also shows the correct pattern for using forms in views, so I don't know why you haven't used that.

(Not related to your problem, but the template path in your call to render_to_response won't work: you should pass a path that is relative to one of the paths in settings.TEMPLATE_DIRS.)

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment