Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to show different page for different device, such as PC and mobile. Is there any way to tell the user-agent in request, and pass the result(the type of device) to the corresponding view? I don't want to differentiate between them in each view.
what i can find is subclass the View class and override the dispatch method. tell the type of access device in the dispath method and save the result as a attribute of the class, so in get and post method i can get it by self.result.
Posted

1 solution

The best and also the easiest way is to use sessions.
https://docs.djangoproject.com/en/dev/topics/http/sessions/#topics-http-sessions[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900