1 2 3 4 5 6 7 8 9 10 11 12 | #myapp/templatetags/blog_filters.py
from django import template
register = template.Library()
import settings
@register.filter('read_more')
def read_more(body, absolute_url):
if '<!--more-->' in body:
return body[:body.find('<!--more-->')]+'<a href="'+str(absolute_url)+'">'+str(settings.READ_MORE_TEXT)+'</a>'
else:
return body
|
More like this
- Hyperlink list filter by lifefloatsby 5 years, 4 months ago
- Template filter to convert timecodes into links by justin_h 3 years, 8 months ago
- Tags & filters for rendering search results by exogen 5 years, 2 months ago
- email_links by sansmojo 5 years, 11 months ago
- Create short URL redirects for site urls. by matt.geek.nz 4 years, 3 months ago
Comments
I'll rewrite this as:
#