djangosnippets.org: Latest snippets tagged with 'get_absolute_url'https://djangosnippets.org/tags/get_absolute_url/2012-07-04T15:50:48.638153-05:00template filter to include protocol and domain in absolute urls
2012-07-04T15:50:48.638153-05:00czerhttps://djangosnippets.org/snippets/2783/<p>I created this template filter to be able to use get_absolute_url in an email template.</p>
<p>Save the code into /templatetags/navigation.py</p>
<p>Use like this:</p>
<pre><code>{% load navigation %}
{{ instance.get_absolute_url|siteabsoluteurl:request }}
</code></pre>
Freely redistributableScriptPrefixMiddleware
2009-09-02T11:11:53.627282-05:00shellsagehttps://djangosnippets.org/snippets/1713/<p>Adds http://hostname or https://hostname before every URL generated by a Django url function.</p>
<p><strong>Example:</strong>
Normally, something like YourModel().get_absolute_url() would return <code>/2009/09/02/slug</code>. However, this is not an absolute URL, because it does not include an HTTP schema or host.</p>
<p>With this middleware, YourModel().get_absolute_url() will return <code>http://yourdomain.com/2009/09/02/slug</code>.</p>
<p>This will also …</p>
Freely redistributablequick_url filter
2008-04-28T23:15:10.173327-05:00tclinekshttps://djangosnippets.org/snippets/730/<p>A simple filter that generates a url from an object that has a get_absolute_url method.</p>
<p>{{ object|quick_url }}</p>
<p>a previous, simpler approach:
<a href="http://www.djangosnippets.org/snippets/511/">#511</a></p>
Freely redistributable