Skip to content
This repository has been archived by the owner on Jul 20, 2018. It is now read-only.

get_by_id should be aware of previous filters #31

Open
kiddouk opened this issue Jun 6, 2012 · 0 comments
Open

get_by_id should be aware of previous filters #31

kiddouk opened this issue Jun 6, 2012 · 0 comments

Comments

@kiddouk
Copy link

kiddouk commented Jun 6, 2012

Considering this case :

class A(models.Model):
    user = models.ReferenceField(B)

class B(models.Model):
    att = models.Attribute()


b1 = B(att='test)
b1.save()

b2 = B(att='test')
b2.save()

a = A(user=b1)
a.save()

self.assertEqual(a.user_set.get_by_id(b1.id), b1)
self.assertEqual(a.user_set.get_by_id(b2.id), None)

The second test will fail as get_by_id doesn't take into account any filter/zfilter/excludes.

kiddouk referenced this issue in kiddouk/redisco Jun 6, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant