ambitioninc/django-entity-subscription — pull request #4 by Wilduck (2014-07-02 18:55:44+00:00)
Title: Is subscribed filtering

@weskendall This pull request makes it easy to pass in an iterable of entities, and get back only those that have a subscription.

This solves the problem in the entity-emailer where we want to check that each entity is subscribed to the email before sending it. Without this method, we would need to iterate through the entities and make an `is_subscribed` call for each of them. Such an approach produces a number of database queries linear with the number of entities. With this method, we get the same functionality with a single database query.

Wes, if you want to have a look at how I'm constructing the query to ensure there are no gross inefficiencies, I'd appreciate it.