On Sun, Sep 28, 2014 at 7:48 PM, Wesley <[email protected]> wrote: > Hi guys, > I have a question about displaying pages according to user agent. > Currently I wanna display menus only when requests from PC browser, i.e. > when receive request from cell phone browser,hide the page menus. > > 1. I set the following in settings.py > DEVICE_USER_AGENTS = ( > ("mobile", ("Android", "BlackBerry", "iPhone")), > ("desktop", ("Windows", "Macintosh", "Linux")), > ) > DEVICE_DEFAULT = "desktop" > > 2. I add mytheme(my own app used to customize > mezzanine)/templates/mobile/base.html, and write some simple words in > base.html. > > Then, run server again, access from PC chrome, it's OK as usual. > But access from my nexus chrome, pages are some as previous. > This is user agent I print: > * PC chrome is Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 > (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36 > * Nexus phone chrome is Mozilla/5.0 (Linux; Android 4.4.4; Nexus 4 > Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 > Mobile Safari/537.36 > > So, seems mezzanine didn't prefix template path with mobile, is there > anything else I should configure or do? > > Thanks. > Wesley > > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > Your phone's user agent also says it's Linux which might cause the behaviour.
Try removing those settings you defined, the default for DEVICE_USER_AGENTS already contains a much more comprehensive list of mobile user agents, and doesn't define any for the desktop, since it's the default already. -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
