Change Django Templates Based on User-Agent

前端 未结 10 2534
耶瑟儿~
耶瑟儿~ 2020-12-07 11:37

I\'ve made a Django site, but I\'ve drank the Koolaid and I want to make an IPhone version. After putting much thought into I\'ve come up with two options:

10条回答
  •  情话喂你
    2020-12-07 11:46

    Rather than changing the template directories dynamically you could modify the request and add a value that lets your view know if the user is on an iphone or not. Then wrap render_to_response (or whatever you are using for creating HttpResponse objects) to grab the iphone version of the template instead of the standard html version if they are using an iphone.

提交回复
热议问题