Created
April 23, 2012 22:25
-
-
Save gustavofonseca/2474273 to your computer and use it in GitHub Desktop.
django caching machine no scielo 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
import caching.base | |
class AppCustomManager(models.Manager): | |
""" | |
Domain specific model managers. | |
""" | |
def available(self, availability=None): | |
""" | |
Filter the queryset based on its availability. | |
""" | |
data_queryset = caching.base.CachingQuerySet(self.model) #usa o queryset cacheado | |
if availability is not None: | |
if not isinstance(availability, bool): | |
data_queryset = data_queryset.filter(is_available=availability) | |
return data_queryset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment