def mobile_template(template):
    def decorator(f):
        @functools.wraps(f)
        def wrapper(request, *args, **kw):
            fmt = {'mobile/': 'mobile/' if request.MOBILE else ''}
            kw['template'] = template.format(**fmt)
            return f(request, *args, **kw)
        return wrapper
    return decorator
Mark a function as mobile-ready and pass a mobile template if MOBILE.
dataset/ETHPy150Open jbalogh/django-mobility/mobility/decorators.py/mobile_template