1 2 3 4 5 6 7 8 9 10 11 12 13 | def link(url, text='', classes=''):
if not text: text = url
if classes: classes = ' class="%s"' % classes
return """<a href="%s"%s>%s</a>""" % (url, classes, text)
def img(url, alt='', classes=''):
if not url.startswith('http://') and not url[:1]=='/':
#add media_url for relative paths
import settings
url = settings.MEDIA_URL + url
if classes: classes = ' class="%s"' % classes
if alt: alt = ' alt="%s" title="%s"' % (alt, alt)
return """<img src="%s"%s%s>""" % (url, classes, alt)
|
More like this
- Boolean Image Flag TemplateTag by MichaelAnckaert 3 years, 5 months ago
- Simple "html email with images" sender by andres_torres_marroquin 1 year, 2 months ago
- Sending html emails with images using Django templates by sleytr 4 years, 11 months ago
- Auto Generate/Save Thumbnails using Template Filter (scale max_x, max_y, or both) by ThisbeTom 3 years, 5 months ago
- iPernity thumbnail helper by sedden 3 years, 6 months ago
Comments