Hi,
have a (probably simple) problem using ModelForms. I'm following this guide:
http://docs.djangoproject.com/en/1.0/topics/forms/modelforms/
Here are my models:
class Run(models.Model):
name = models.CharField(max_length=200)
class RunForm(ModelForm):
class Meta:
model = Run
I already have some objects of class Run. But I don't know how to work
with them and the ModelForm
>>> r = Run.objects.get(pk=1)
>>> f=RunForm(instance=r)
>>> f.is_valid()
False
>>> f.save()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/django/forms/models.py", line
407, in save
fail_message, commit, exclude=self._meta.exclude)
File "/usr/lib/python2.5/site-packages/django/forms/models.py", line
43, in save_instance
cleaned_data = form.cleaned_data
AttributeError: 'RunForm' object has no attribute 'cleaned_data'
>>> f.errors
{}
>>>
What did I misunderstood?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.