Created
February 12, 2014 23:47
-
-
Save toshism/8966942 to your computer and use it in GitHub Desktop.
Custom manager on base class
This file contains 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
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