Example #1
0
def render_common(obj, filename, version):
    if settings.COMPRESS:
        filename = get_output_filename(filename, version)

    context = template.Context(obj.get('extra_context', {}))
    prefix = context.get('prefix', None)
    if filename.startswith('http://'):
        context['url'] = filename
    else:
        context['url'] = compress_url(filename, prefix, version)
        
    return obj['template'].render(context)
def render_common(template_name, obj, filename, version):
    if settings.COMPRESS:
        filename = get_output_filename(filename, version)

    context = obj.get('extra_context', {})
    prefix = context.get('prefix', None)
    if filename.startswith('http://'):
        context['url'] = filename
    else:
        context['url'] = compress_url(filename, prefix)
        
    return template.loader.render_to_string(template_name, context)
Example #3
0
def render_common(template_name, obj, filename, request, version):
    if settings.COMPRESS:
        filename = get_output_filename(filename, version)

    context = obj.get("extra_context", {})
    prefix = context.get("prefix", None)
    if filename.startswith("http://"):
        context["url"] = filename
    else:
        context["url"] = compress_url(filename, request, prefix)

    return template.loader.render_to_string(template_name, context)
Example #4
0
def render_common(obj, filename, version):
    if settings.COMPRESS:
        filename = get_output_filename(filename, version)

    context = template.Context(obj.get('extra_context', {}))
    prefix = context.get('prefix', None)
    if filename.startswith('http://'):
        context['url'] = filename
    else:
        context['url'] = compress_url(filename, prefix)

    if not settings.COMPRESS:
        # append querystring version when not compressing files
        context['url'] = '%s?%s' % (context['url'], get_version([filename]))

    return obj['template'].render(context)