mini_render_to_response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
def mini_render_to_response(template, context, context_instance, try_mobile = True, *args, **kwargs):
    render = None
    if try_mobile and context_instance['request'].GET.has_key('mini'):
        try:
            file, ext = template.split('.')
        except ValueError: pass
        else:
            mini_template = file + '_mini.' + ext
            try:
                render = render_to_response(mini_template, context, context_instance=context_instance, *args, **kwargs)
            except TemplateDoesNotExist: pass
    
    if not render:
        render = render_to_response(template, context, context_instance=context_instance, *args, **kwargs)
    
    return render

More like this

  1. Detect iPhone & Switch Template via render_to_response by bryanhelmig 2 years ago
  2. Mobilize your Django site by stevena0 3 years, 1 month ago
  3. SOAP web service with soaplib 0.9+ by wRAR 1 year, 8 months ago
  4. HTML 5 Firefox 2 Hack by epicserve 2 years, 6 months ago
  5. Create PDF files using rml and django templates by mporrato 4 years, 11 months ago

Comments

(Forgotten your password?)