Snippet List
A template filter which wraps imagemagick's `convert` command. The filter acts upon a source image path, and returns the filtered image path.
usage: {{ source_path|convert:"-resize 64x64\!" }}
The filter parameter is the processing arguments for an ImageMagick 'convert' command. See e.g. http://www.imagemagick.org/Usage/resize/
Every image created is saved in a cache folder. This code does not handle removing obsolete cached images. If the filtered image path exists already, no image processing is carried out, and the path is returned.
- filter
- image
- templatetag
- imagemagick
This is a template tag that works like `{% include %}`, but instead of loading a template from a file, it uses some text from the current context, and renders that as though it were itself a template. This means, amongst other things, that you can use template tags and filters in database fields.
For example, instead of:
`{{ flatpage.content }}`
you could use:
`{% render_as_template flatpage.content %}`
Then you can use template tags (such as `{% url showprofile user.id %}`) in flat pages, stored in the database.
The template is rendered with the current context.
Warning - only allow trusted users to edit content that gets rendered with this tag.
This template tag takes the current GET query, and modifies or adds the value you specify. This is great for GET-query-driven views, where you want to provide URLs which reconfigure the view somehow.
**Example Usage:**
`{% get_string "sort_by" "date" %}` returns `all=your¤t=get&variables=plus&sort_by=date`
- templatetag
- get
- context
- request
cogat has posted 3 snippets.