Skip to content

Instantly share code, notes, and snippets.

@toshism
Created February 12, 2014 23:47
Show Gist options
  • Save toshism/8966942 to your computer and use it in GitHub Desktop.
Save toshism/8966942 to your computer and use it in GitHub Desktop.
Custom manager on base class
class AwesomeCustomManager(models.Manager):
def get_query_set(self):
return SuperAwesomeQuerySet(self.model)
def __getattr__(self, attr):
if attr.startswith('__'):
raise AttributeError("%r object has no attribute %r" %
(self.__class__, attr))
return getattr(self.get_query_set(), attr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment