Created
August 24, 2015 16:04
-
-
Save Walkeryr/f01dc77eab271018fbef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def detect_mobile(f): | |
def wrapped(*args, **kwargs): | |
request = args[0] | |
if request.mobile and not request.tablet: | |
path_lang = request.path.find('/en/') | |
if path_lang != -1 and request.path.find('/mobile/') == -1: | |
return HttpResponseRedirect('/en/mobile' + request.path[3:]) | |
return HttpResponseRedirect('/mobile' + request.path) | |
return f(*args, **kwargs) | |
return wrapped |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment