Skip to main content

Django middleware and view decorator to add browser info to the request object

Project description


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


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


True for devices that use touch events.

Wide Device


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

Device Type


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


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


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

All Requests

To use browser_info on all requests just add


to the `MIDDLEWARE_CLASSES` tuple in your

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 browser_info import add_browser_info

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

Project details

Download files

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

Files for django-browser-info, version 1.0.1
Filename, size & hash File type Python version Upload date
django-browser-info-1.0.1.tar.gz (4.7 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page