Skip to content

Instantly share code, notes, and snippets.

@puentesarrin
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puentesarrin/3d14f739f8c0b0d16201 to your computer and use it in GitHub Desktop.
Save puentesarrin/3d14f739f8c0b0d16201 to your computer and use it in GitHub Desktop.
class BadgeManager(Manager) # This equals your BaseBadgeManager
def get_by_id(self, roar_id, id_or_ids):
pass
def drop(self, roar_id, badge_id):
pass
class BaseBadge(models.Model):
objects = BadgeManager()
class Meta:
abstract = True
class PostBadgeManager(Manager):
def get_by_roar_id(self, roar_id):
pass
def invalidate_key(self):
self._model.CACHE_TEMPLATE # This should be the way to use the cache attributes from the model
pass
@classmethod
def get_cache_key(cls):
cls._model.CACHE_TEMPLATE # Not possible, model is None for classmethods
pass
class PostBadge(BaseBadge):
CACHE_TEMPLATE = ''
posts_objects = PostBadgeManager()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment