简单的中间件和助手功能,帮助处理来自移动设备的请求。
Django-MobilityHelpers的Python项目详细描述
=====
移动助手
=====
版本:0.3
作者:thomas weholt<;thomas@weholt.org>;
许可证:修改后的BSD
www:https://bitbucket.org/weholt/django mobility helpers
状态:beta-实验版。
about
----
mobility helpers是一款小型的可重用django应用程序,使其更容易瞄准移动平台/设备。它作为中间件
和呈现视图的助手函数而来。
简而言之,使用特殊函数呈现视图将检测来自移动设备的请求并为该设备寻找特殊模板。普通客户
将得到一个普通模板。因此,如果您使用平板电脑访问页面,应用程序将使用templatename.mobile.html而不是templatename.html呈现视图。
installation
----
*pip install django mobilityhelpers
*将“mobilityhelpers.middleware.mobiledectionmiddleware”添加到设置中的中间件部分。py
*在视图中执行'从mobilityhelpers导入smart_response'
用法
----
*安装后,您的请求实例应具有'is_mobile'属性。您可以使用此选项来调整移动设备的QuerySet等。
*不要使用Render_to_Response,而是使用Smart_Response(请求、模板名称,上下文数据)。
例如,对于ipad(目前唯一受支持的设备),当使用ipad访问时,将
render index.ipad.html而不是index.mobile.html。所有其他受支持的移动设备都将使用index.mobile.html。
changlog
-
-
<0.3.0-django 2.0支持
org/snippets/2001/
移动助手
=====
版本:0.3
作者:thomas weholt<;thomas@weholt.org>;
许可证:修改后的BSD
www:https://bitbucket.org/weholt/django mobility helpers
状态:beta-实验版。
about
----
mobility helpers是一款小型的可重用django应用程序,使其更容易瞄准移动平台/设备。它作为中间件
和呈现视图的助手函数而来。
简而言之,使用特殊函数呈现视图将检测来自移动设备的请求并为该设备寻找特殊模板。普通客户
将得到一个普通模板。因此,如果您使用平板电脑访问页面,应用程序将使用templatename.mobile.html而不是templatename.html呈现视图。
installation
----
*pip install django mobilityhelpers
*将“mobilityhelpers.middleware.mobiledectionmiddleware”添加到设置中的中间件部分。py
*在视图中执行'从mobilityhelpers导入smart_response'
用法
----
*安装后,您的请求实例应具有'is_mobile'属性。您可以使用此选项来调整移动设备的QuerySet等。
*不要使用Render_to_Response,而是使用Smart_Response(请求、模板名称,上下文数据)。
例如,对于ipad(目前唯一受支持的设备),当使用ipad访问时,将
render index.ipad.html而不是index.mobile.html。所有其他受支持的移动设备都将使用index.mobile.html。
changlog
-
-
<0.3.0-django 2.0支持
org/snippets/2001/