Colin,

Thanks... no, I'm saying anything about an "assert" statement as I did not 
use it.  I'm saying that
: when I call the main class object ("class Member"), the return is all 
records in the database (as expected). 
: when I call the custom subclass object (class MemberActive), I expect a 
filtered list, but it returns all records (not expected and "the bug")
: when I call the custom subclass object (class MemberActive), and filter 
it, the return is only active members (as expected)

I've never used asserts. I added your assert line into the code and Python 
fails. I know little about asserts and will have to research what that's 
all about.  Probably a clue.


On Monday, 3 November 2014 01:51:59 UTC, Collin Anderson wrote:
>
> Hello
>
> You are saying this doesn't work as expected?
>
> class MemberActive(models.Manager):
>     def get_queryset(self):
>         qs = super(MemberActive, self).get_queryset().filter(status=
> 'Active')
>         return qs
>
> class Member(models.Model):
>     # etc
>     Active_objects = MemberActive()
>
> assert all(m.status == 'Active' for m in Member.Active_objects.all())
>
> Collin
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dc828809-d0f9-4ad3-a510-a03006b67acd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to