Thanks Russel,

You've always been very helpful. :-) Now that I get the basic idea of how it
works, I will get some resources on Python metaprogramming. It seems to be
used heavily in Django ORM.

Kind Regards,

On Mon, Jul 20, 2009 at 8:45 PM, Russell Keith-Magee <freakboy3...@gmail.com
> wrote:

>
> On Mon, Jul 20, 2009 at 4:05 PM, Joshua Partogi<joshua.part...@gmail.com>
> wrote:
> > Dear all,
> >
> > This may seems trivial. I've been looking at django source code
> > model/base.py and been looking around how django gives my model an
> objects
> > attribute but can not find it. I can see that the ModelBase will give the
> > _default_manager attribute, but where and how does this objects attribute
> > given? Can anybody give me a clue on which source file I should look
> around
> > for this?
>
> You're close to the mark, but you've missed a crucial detail - which
> is understandable, because the detail is a little obscure.
>
> Towards the end of ModelBase.__new__ (the meta constructor) is a call
> to _prepare(). This call to _prepare emits a "class_prepared" signal.
> This signal fires the "ensure_default_manager" listener in
> django.db.models.manager.py, which sets up the 'objects' object.
>
> As a side note, if you're poking around Django's internals to this
> sort of level, it might be worth getting a copy of Marty Alchin's "Pro
> Django". This book covers the internal mechanics of Django in a lot of
> detail.
>
>

-- 
http://blog.scrum8.com
http://twitter.com/scrum8

--~--~---------~--~----~------------~-------~--~----~
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