Hi DR,
  Thank you very much! It works now. I will check the doc about the
difference of the queryset and instance. Anyway, thanks a lot!

2009/12/1 Daniel Roseman <dan...@roseman.org.uk>

> On Dec 1, 3:24 pm, 邓超 <knifew...@gmail.com> wrote:
> > Hi all,
> >   I'm writing a small app, and get an error when trying to update the
> > object, the error message is
> >
> > 'QuerySet' object has no attribute '_meta'. and It shows that I made
> > some mistake on this line:
> > form = ProjectForm(instance = projectInstance). But I don't know where
> > am I wrong. The below is my code in views.py.
> >
> > @login_required
> > def edit_project(request, project_id = None):
> >     if project_id == None:
> >         projectInstance = Project()
> >     else:
> >         projectInstance = Project.objects.filter(id =
> > project_id).filter(Q(creater = request.user) | Q(administrator =
> > request.user))
>
> Here's your problem. filter() returns a queryset, not an instance.
> Either use get() (if you're sure you're never going to have more than
> one matching object), or slice the result with [0] to get a single
> instance.
> --
> DR.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>


-- 
Deng Chao

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.


Reply via email to