I can't seem to reason out why/how this works.

I have a class Named Stuff

I can say Stuff.objects.filter(.....) and that will return valid set
of data.

What I can't understand is what exactly is objects, and why is it I
can call it with Stuff.objects, but I can't call it with stuff.objects
(an instance of Stuff).

>>> dir(Stuff) shows me 'objects'
>>> dir(stuff) shows me 'objects'

>>> type(Stuff.objects)
<class 'django.db.models.manager.Manager'>
>>> type(stuff.objects)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "...manager.py", line 151, in __get__
AttributeError: Manager isn't accessible via Stuff instances

What is the python Magic going on here to make this possible?

I'm asking because I want to make something like 'objects' in that it
doesn't need an instance, but it is scoped within the model of Stuff.

My background is C++ and these look like methods/objects that are
static to the class, not part of the instances.  I just can't figure
out how to declare and instantiate them in python.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to