1 2 3 4 5 6 7 8 9 10 11 12 | from django.shortcuts import render_to_response as render_to_response_pre
def render_to_response(template, context):
'''
If the exisiting view uses a template named foo.html, any iPhone
will trigger the template named foo-iphone.html.
'''
if 'HTTP_USER_AGENT' in context['request'].META:
if 'iphone' in context['request'].META['HTTP_USER_AGENT'].lower():
template = template.rstrip('.html')
template += '-iphone.html'
return render_to_response_pre(template, context)
|
More like this
- mini_render_to_response by menendez 4 years, 1 month ago
- Simple Mobile Support by bahoo 2 years, 7 months ago
- iPhoneMiddleware by henriklied 4 years, 7 months ago
- Mobile Device Middleware by stephen_mcd 2 years, 12 months ago
- Mobile browser detection middleware by pavl 3 years ago
Comments