1 2 3 4 5 6 7 8 9 | import re
from django.utils.encoding import smart_unicode
r_lightbox = re.compile('<a (?=[^>]*\.(jpg|gif|png))(?![^>]*lightbox)')
s_lightbox = '<a rel="lightbox" '
@register.filter
def lightbox(content):
return r_lightbox.sub(s_lightbox, smart_unicode(content))
|
More like this
- True links in the admin list by svetlyak 5 years, 8 months ago
- Template tags to integrate with modconcat by matthanger 3 years, 10 months ago
- iPernity thumbnail helper by sedden 4 years, 6 months ago
- Filter to resize a ImageField on demand by michelts 6 years, 1 month ago
- Cacheable resources by jbrisbin 4 years, 9 months ago
Comments