On Thu, Mar 21, 2013 at 7:49 AM, simon xue <hellangelsma...@gmail.com> wrote:
> Hi,When I read the book named "Learning Website Development With
> Django",step by step to doing the example,When I read to page 31,"To get an
> object by ID,type the following:    >>>Link.object.get(id=1)   " I got this
> error: "Traceback <most recent call last>:
> File "<console>",line 1,in<module>
> File"c:\python27\lib\site-packages\django\db\models\managers.py",line 232,in
> __get__
>     raise AttributeError("manager isn't accessible via %s instances" %
> type.__name__)
> AttributeError: Manage isn't accessible via Link instances"
>
> How can I solve this problem?
>
> Thank U
>

You cannot access the 'objects' attribute through an instance of a
class, you must do it through the class method.

In addition to what Matt said ('objects', not 'object'), this could
happen if you typed exactly what you had said if you had redefined
what 'List' refers to. Eg:

>>> Link.objects.get(id=1)
<Link: a link>
>>> Link = Link.objects.get(id=1)
>>> Link.objects.get(id=1)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "…/django/db/models/manager.py", line 219, in __get__
    raise AttributeError("Manager isn't accessible via %s instances" %
type.__name__)
AttributeError: Manager isn't accessible via Link instances


If you are still having problems, copy and past your entire console
session so that we can see what you have done!

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to