Hi James,

Thanks for answering my questions, but your example of re-assigning
model.objects doesn't jive well with me. How is the current
implementation of having (to me) obfuscated way of determining what
the default manager is? If you stupendously re-assign model.objects,
then sure you will break it, but how is the current implementation any
better?

I'm just confused about why it is implemented in that manner.

Maybe this comes later in the book, but...

What is the purpose of having a default manager anyhow?

How can I always ensure I access the default manager, if it isn't
always available at model.objects?

On Mar 14, 4:36 pm, James Bennett <ubernost...@gmail.com> wrote:
> On Mon, Mar 14, 2011 at 6:14 PM, gamingdroid <gamingdr...@gmail.com> wrote:
> > So if the default manager isn't named objects, then how does the code
> > know where the default lives?
>
> There's internal API for asking a model class what its default manager
> is, and Django makes use of it. Most things you'd want to find out
> about a model are available that way.
>
> > Basically, it seems the default manager should always be the one that
> > normally lives in objects at all time since it is guaranteed to
> > support a subset of commonly used database operations.
>
> No it's not. Here:
>
> class StupidManager(models.Manager):
>     def filter(self):
>         raise NotImplementedError
>
> class StupidModel(models.Model):
>     objects = StupidManager()
>
> Whoops.
>
> > Sorry, this discussion is actually spawning many more questions, but I
> > think I'm getting closer. I just wish Django had a nice documentation
> > system like Javadocs. The docs available at Django seems to  introduce
> > you on how to use the class/feature more than explain what each method
> > does.
>
> There are many tools available which will spit out Javadoc-style API
> references from Python source code (e.g., epydoc). Since that requires
> no effort whatsoever to do, we spend our time on documentation that
> *can't* just be automatically generated on demand.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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