I've filed #7666 [1] which has a test I wrote that fails to illustrate
what I believe is a bug. The code is a lot easier to understand than
my english, so I'll let it speak for itself. To be clear, I'm just
talking about changing the behavior of
ReverseSingleRelatedObjectDescriptor, not
SingleRelatedObjectDescriptor.

I couldn't find any related tickets, so if nothing else I hope this
ticket helps people find the reasoning even if we just close it.
Here's the example:

class SourceManager(models.Manager):
    def get_query_set(self):
        return super(SourceManager, self).get_query_set().filter(is_public=True)

class Source(models.Model):
    is_public = models.BooleanField()
    objects = SourceManager()

class Item(models.Model):
    source = models.ForeignKey(Source)

>>> public_source = Source.objects.create(is_public=True)
>>> public_item = Item.objects.create(source=public_source)

>>> private_source = Source.objects.create(is_public=False)
>>> private_item = Item.objects.create(source=private_source)

# SUCCESS
>>> public_item.source
<Source: Source object>

# FAIL: Raises DoesNotExist when it quite clearly *does* exist. I
don't think the default manager should have any say here)
>>> private_item.source
<Source: Source object>

Joseph

[1] http://code.djangoproject.com/ticket/7666

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