On Mon, Mar 14, 2011 at 6:14 PM, gamingdroid <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.