Adrian Holovaty wrote:
> This is certainly a bug. The main question is how to fix it.

Oh, it's a big can of worms, actually. I was once pondering on this and 
found some tricky cases.

1) Managers are not just restrict querysets by filtering. They can be 
used for example to produce custom queryset classes with new properties, 
which in turn produce instances with new properties. Then if you use 
some "default" queryset for accessing a parent it'll lack the behavior 
of other instances of its class.

2) There's a problem with filtering managers not only on the way up 
(from child to parent) but on the way down also. If you want to delete a 
parent it will try to delete its children beforehand. But if the default 
manager of children won't give them all DB won't let the object be deleted.

> Currently, ReverseSingleRelatedObjectDescriptor uses _default_manager,
> which is the problem (line 239 in django/db/models/related/fields.py).
> One clean solution would be to give each model a _pristine_manager
> attribute, which would be *guaranteed* to be a simple Manager()
> instance

Yes I think there should be some pristine manager but it should not be 
automatically a simple Manager() instance. Instead it should be a public 
attribute "all_objects" that can be set by user but should contain a 
manager giving all objects. By default it will of course be just 
Manager() and be equal to "objects".

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to