Decorator, written for views simplification. Will render dict, returned by view, as context for template, using RequestContext. Additionally you can override template, returning two-tuple (context's dict and template name) instead of just dict.
Usage:
@render_to('my/template.html')
def my_view(request, param):
if param == 'something':
return {'data': 'some_data'}
else:
return {'data': 'some_other_data'}, 'another/template.html'
- render_to_response
- requestcontext
- shortcut
- decorator
- rendering
This is a [Django template tag](http://www.djangoproject.com/documentation/templates_python/#extending-the-template-system "Extending the template system") that renders an arbitrary block of text with Markdown and [Pygments](http://pygments.org "Syntax highlighter").
Use Markdown as usual, and when you have a code block to insert, put it inside `code` tags, with the language as the class:
`<code class='python'>print "Hello, World"</code>`
To use it in a template, first `{% load ... %}` the tag library, then `{{ content|render }}` your content.
The tag takes one optional argument, to enable safe rendering in markdown. To use it, call `{{ content|render:"safe" }}`.
- pygments
- markdown
- syntax-highlighting
- template-tag