Created
August 31, 2012 22:44
-
-
Save epicserve/3560364 to your computer and use it in GitHub Desktop.
People Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import Manager | |
class PeopleManager(Manager): | |
"""Returns published objects that are not in the future.""" | |
def active(self): | |
return super(PeopleManager, self).get_query_set().filter(is_active=True) | |
def staff(self): | |
return super(PeopleManager, self).get_query_set().filter(is_active=True, is_staff=True) | |
def has_responsibility(self, responsibility): | |
return super(PeopleManager, self).get_query_set().filter(is_active=True, is_staff=True).filter(responsibilities__slug=responsibility) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment