Skip to main content

Device browser detection in Django

Project description

Django Mobile Detector

Mobile Detect is a lightweight Python package for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

PHP

this package development based from php big repository Mobile-Detect

http://demo.mobiledetect.net/logo-github.png

Installation

  1. Python package install:

    pip install django-mobile-detect
  2. Add `mobiledetect` to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'mobiledetect',
    ]
  3. Middleware:

    MIDDLEWARE_CLASSES = (
        '...',
        'mobiledetect.middleware.DetectMiddleware',
        '...'
    )

View Usage

You can use in views

Check if the device is mobile.

request.device.is_mobile

Check if the device is a tablet.

request.device.is_tablet

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-mobile-detect-0.1.tar.gz (25.4 kB view details)

Uploaded Source

File details

Details for the file django-mobile-detect-0.1.tar.gz.

File metadata

  • Download URL: django-mobile-detect-0.1.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.6

File hashes

Hashes for django-mobile-detect-0.1.tar.gz
Algorithm Hash digest
SHA256 65685d861977ef644404e8c9f04868958d7d51403f4d0c6badfb7558c5384228
MD5 edf0104ca1daec774e4e09d74e4680ba
BLAKE2b-256 a460a34f07d12a9d41d52d1c6cd5af1a666b61fec802875274597908b183e312

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page