No project description provided
Project description
settings.py
MIDDLEWARE_CLASSES = ( ... 'django_mobileesp.middleware.UserAgentDetectionMiddleware' ) from django_mobileesp.detector import mobileesp_agent as agent DETECT_USER_AGENTS = { 'is_android': agent.detectAndroid, 'is_ios': agent.detectIos, 'is_windows_phone': agent.detectWindowsPhone, 'is_mobile': agent.detectTierTablet | \ agent.detectTierIphone | \ agent.detectMobileQuick, }
If you prefer more pythonic methods, you can user a wrapper agent as follows:
from django_mobileesp.detector import python_agent as agent DETECT_USER_AGENTS = { 'is_android': agent.detect_android, 'is_ios': agent.detect_ios, 'is_windows_phone': agent.detect_windows_phone, 'is_mobile': agent.detect_tier_tablet | \ agent.detect_tier_iphone | \ agent.detect_mobile_quick, }
Finally access the defined attributes in your views:
def view(request): if request.is_mobile: ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Django-Mobileesp-1.0.0.tar.gz
(9.7 kB
view hashes)
Built Distribution
Close
Hashes for Django_Mobileesp-1.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97b34a2ebb92c384b93c23804117b594d0311b773723462430839057dabd95cb |
|
MD5 | 200ea774303b4577641c23c383834621 |
|
BLAKE2b-256 | fad7c7eeae30d5cebe452e6938af25c943aec3ae046574c8ba1f6a7c7e713108 |