ambitioninc/django-entity — pull request #13 by wesleykendall (2014-03-09 07:27:14+00:00)
Title: Additional filtering capabilities

@WilDuck I added additional filtering capabilities in django entity very similar to the types of filtering we discussed. Specifically,

1. When you get an entity, you can now call entity.get_super_entities().active() to get the active super entities or entity.get_super_entities().active().is_type(super_entity_content_type) to get the active super entities of a certain type
2. You can now call Entity.objects.intersect_super_entities(superentity1, superentity2) and it will return a list of entities that fall in the intersection of those super entities. You can also perform the intersection on a queryset. It only results in one query too :)
3. You can call Entity.objects.filter(....).cached_relationships() and it will cache the entity relationships so that you can quickly filter entity relationships without incurring additional db overhead

I tested it pretty thoroughly (still 100%) and updated docs. Turns out there is a self.assertNumQueries function to check how many queries a block of code issues.