Git Product home page Git Product logo

minidetector's Introduction

About

This application adds attributes to your request object that describe the users browser. This will let you fine tune the templates or code to use based on the traits of the browser.

The following is currently added to the request:

Simple Device

request.is_simple_device

True for all non-desktop devices (browsers) without "modern" CSS and JS support. This includes non "smart" phones and simpler browsers like those found on game consoles and the kindle.

Touch Device

request.is_touch_device

True for devices that use touch events.

Wide Device

request.is_wide_device

True for devices that are wider than a common mobile phone. This covers tablets and desktop browsers.

Device Type

request.is_ios_device
request.is_android_device
request.is_webos_device
request.is_windows_phone_device

True if the device is part of the given platform.

These give more granular information about modern smart devices. This is helpful if you want to target features to a specific device type.

Other Attributes

request.is_webkit

True if the browser is webkit (desktop or mobile.)

Installation

After you've added minidetector to your python path (manually or with pip) you can access its attributes with one of two methods.

All Requests

To use minidetector on all requests just add

minidetector.Middleware

to the MIDDLEWARE_CLASSES tuple in your settings.py

Specific Requests

If you only have certain views that need the distinction all you need to do is wrap the relevant views like this:

from minidetectordetector import detect_mobile

@detect_mobile
def my_mobile_view(request):
	# your view code here.

minidetector's People

Contributors

bne avatar brosner avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.