change django templates formed user-agent
i've finished django site, nonetheless i've drank koolaid i wish an iphone version. after putting many guess i've adult twin options:
- make whole site, i.xxxx.com. tie same database controlling django's sites framework.
- find middleware reads user-agent, changes template directories dynamically.
i'd unequivocally move choice #2, however; i have reservations, especially since django support . i found i'd like. sure emanate carrying seamless possible, i'd automagic pristine user.
has anyone else opposing same issue? anyone caring share they've tackled origination iphone versions django sites?
update
i went multiple middleware tweaking template call.
for middleware, i used . i since detects mobile user-agents. i have check request.mobile views.
for template tweak:
def check_mobile(request, template_name):
request.mobile:
relapse 'mobile-%s'%template_name
relapse template_name
i any perspective i know i have both versions.
todo:
- figure out opening request.mobile an extended chronicle render_to_response i don't have check_mobile('template_name.html')
- using before automagically fallback unchanging template mobile chronicle exists.
Comments
Post a Comment