Login

Snippets by gobble

Snippet List

Use MEDIA_URL in flatpages with SSL

This is a copy of [snippet 654](http://djangosnippets.org/snippets/654/), modified to allow dynamic MEDIA_URL, as you might need that for SSL in combination with [snippet 1754](http://djangosnippets.org/snippets/1754/). This is a template filter to enable the use of the MEDIA_URL setting in content from the flatpages database table. It searches for {{ MEDIA_URL }} and replaces it with the current MEDIA_URL added by a context processor. Note: To set up, drop the above code into a file called media_url.py in your templatetags directory in one of your INSTALLED_APPS, and add the filter to your flatpages template like so: {% load media_url %} {{ flatpage.content|media_url:MEDIA_URL }}

  • filter
  • ssl
  • context
  • flatpages
  • processor
Read More

gobble has posted 1 snippet.