That would be it! Thanks for your prompt help - onwards....
On Jul 28, 7:06 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Tue, Jul 28, 2009 at 2:02 PM, phoebebright<phoebebri...@spamcop.net> wrote:
>
> > I thought I was faithfully coping the tutorial, so don't understand
> > why I get this error.
>
> > Here is the code in the view:
>
> > @login_required
> > def edit_todo(request, todo_id):
>
> > task = Task.objects.get(id=todo_id)
>
> > if request.method == 'POST':
> > form = TaskForm(request.POST)
> > ...
>
> > else:
> > form1 = TaskForm() # this is ok
> > form2 = TaskForm(instance=task) #this fails with error
>
> > __init__() got an unexpected keyword argument 'instance'
>
> > Form is simple:
>
> > class TaskForm(forms.Form):
> > owner = forms.ModelChoiceField(Who.objects.filter(owner=1),
> > empty_label=None, required=True)
> > name = forms.CharField(max_length=140, required=True)
> > taglist = forms.CharField(max_length=100, required=False)
> > description = forms.CharField(widget=forms.Textarea,
> > required=False)
>
> > class Media:
> > js = ('/js/jquery.js', '/js/jquery-ui.min.js','js/
> > jeditable.js',)
> > css = { 'all': ('/css/jquery-ui.css','/css/smoothness/jquery-
> > ui-1.7.2.custom.css') }
>
> > class Meta :
> > model = Task
>
> > ??? Is it something obvious again?
>
> It looks like you intended to use a ModelForm, but instead inherited
> from Form, change you form to subclass forms.ModelFrom.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> "The people's good is the highest law." -- Cicero
> "Code can always be simpler than you think, but never as simple as you
> want" -- Me
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---