"Link To" helper tag
Simple template tag that assumes some common conventions in order to quickly get a link to a specific model instance.
- template
- models
- links
- tags
- anchors
Simple template tag that assumes some common conventions in order to quickly get a link to a specific model instance.
Finds links from a body of html so you can display them elsewhere.
Almost too dumb to be worth posting but its saved me a lot of typing. Instead of: <div> <a href="{{ object.get_absolute_url }} class="object-icon">{{ object }}</a> </div> just put: <div>{{ object|link }}</div>
This is a simple filter that takes an object list and returns a comma-separated list of hyperlinks. I use it to display the list of tags in my blog entries. The function assumes the object has a `get_absolute_url()` method that returns the URL. In your template, write `{{ obj_list|hyperlink_list:"slug" }}` where `obj_list` is your object list and `"slug"` is the object's attribute that returns the link text.