Ticket #20741: patch.diff

File patch.diff, 1.4 KB (added by palkeo, 11 years ago)
  • django/core/management/templates.py

    diff --git a/django/core/management/templates.py b/django/core/management/templates.py
    index 1de508d..f31d33e 100644
    a b class TemplateCommand(BaseCommand):  
    5353                    action='append', default=[],
    5454                    help='The file name(s) to render. '
    5555                         'Separate multiple extensions with commas, or use '
    56                          '-n multiple times.')
     56                         '-n multiple times.'),
     57        make_option('--extra-context', '-c', dest='extra_context',
     58                    action='append', default=[],
     59                    help='Extra context to pass to template files to render. '
     60                         'Must be "variable_name=value". '
     61                         'You can use that option multiple times.'),
    5762        )
    5863    requires_model_validation = False
    5964    # Can't import settings during this command, because they haven't
    class TemplateCommand(BaseCommand):  
    110115        else:
    111116            docs_version = '%d.%d' % django.VERSION[:2]
    112117
    113         context = Context(dict(options, **{
     118        extra_context = dict(map(lambda a: a.split('=', 1), options['extra_context']))
     119
     120        context = Context(dict(extra_context, **{
    114121            base_name: name,
    115122            base_directory: top_dir,
    116123            'docs_version': docs_version,
Back to Top