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
| def get_cache_key(model, pk): | |
| """ | |
| Generates a cache key based on ``WRITE_CACHE_PREFIX``, the cache key prefix | |
| defined in the settings file (if any), the Django app and model name, and | |
| the primary key of the object. | |
| """ | |
| params = { | |
| 'prefix': getattr(settings, 'WRITE_CACHE_PREFIX', ''), | |
| 'app': model._meta.app_label, | |
| 'model': model._meta.object_name, |
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
| # http://djangosnippets.org/snippets/1655/ | |
| from django import template | |
| from BeautifulSoup import BeautifulSoup, Comment | |
| import re | |
| register = template.Library() | |
| def sanitize(value, allowed_tags): | |
| """Argument should be in form 'tag2:attr1:attr2 tag2:attr1 tag3', where tags |