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 CustomQuerySetManager(Manager): | |
""" | |
A re-usable Manager to access a custom QuerySet | |
""" | |
def __getattr__(self, attr): | |
# don't delegate internal methods to queryset | |
# NOTE: without this, Manager._copy_to_model will end up calling | |
# __getstate__ on the *queryset* which causes the qs (as `all()`) | |
# to evaluate itself as if it was being pickled (`len(self)`) | |
if attr.startswith('__'): |