~ubuntuone-hackers/django-formfieldset/trunk

« back to all changes in this revision

Viewing changes to example/examples/templatetags/examples_tags.py

  • Committer: Atamert Ölçgen
  • Date: 2010-01-02 20:08:58 UTC
  • Revision ID: git-v1:ede0a44b9f954cbb375c816552abc89cae82e745
individual fieldset rendering example

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
2
2
from django import template
 
3
from django.conf import settings
3
4
from django.template.loader import find_template_source
4
5
from django.template.loader import get_template_from_string
5
6
from django.utils.html import escape
38
39
def example(example_name):
39
40
    form, form_code = get_form(example_name)
40
41
    template_obj, template_code = get_template(example_name)
41
 
    rendered = template_obj.render(template.Context({'form': form()}))
 
42
    rendered = template_obj.render(template.Context({'form': form(),
 
43
                                            'MEDIA_URL': settings.MEDIA_URL}))
42
44
    if highlight:
43
45
        formatter = HtmlFormatter()
44
46
        form_code = highlight(form_code, PythonLexer(), formatter)