Support for Mobile DevicesΒΆ
Playdoh enables you to create Django apps that run on mobile devices using the django-mobility middleware which negotiates between user agents. In your templates, you can check if you’re in mobile like this:
{% if request.MOBILE %}
{{ _('This text is only visible on mobile devices.') }}
{% endif %}
In your views module you can use the mobility decorator to toggle between templates:
from mobility.decorators import mobile_template
@mobile_template('examples/{mobile/}home.html')
def home(request, template=None):
# ...
return jingo.render(request, template, data)
See the django-mobility documentation for more details about setting up your backend.
For frontend mobile strategies like media queries and other alternatives, check out Approaches to Mobile Web Development followed by Part 2 (Separate Sites) and Part 3 (Responsive Design).
To develop mobile sites you can simulate various headers using the User Agent Switcher for Firefox.