Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (31 sloc) 1.93 KB


A django app that helps you use ZeroPush's push notification API simply in your django backend for an iOS app.

django-zeropush features

  1. a simple HTTP POST interface for adding new push devices connected to the current django user session
  2. easy to use methods for sending push notifications to a user's all devices /or/ a group of specific devices
  3. a PushDevice model that is connected to django's built-in user model (and also works with django 1.5+ custom user models)

Example code

Sending a notification to a user

import zeropush

# Get a user. Can also be a custom user model in django 1.5+
the_user = User.objects.filter(username="johndoe")

zeropush.notify_user(the_user, alert="Here's some notification text", sound="default", badge_number=1)

Getting all users' push devices and sending a notification to all of them

import zeropush
from zeropush.models import PushDevice

# PushDevice is a model in django-zeropush that has a device token (string) and is connected to a django user.
all_devices = PushDevice.objects.all()

zeropush.notify_devices(all_devices, alert="Here's some text to all users")


  1. Add zeropush to your INSTALLED_APPS in your project's
  3. Include zeropush.urls to your if you want a HTTP POST API for adding a push device token to a logged in user. See below for how to POST to it.
  4. Run ./ syncdb to create the PushDevice model's table.
  5. Now you can send push notifications as above!

The HTTP API for adding new push tokens

Once you've added zeropush.urls to your file, a logged in user session can POST to /zeropush/add_device/ with a parameter token which is the device token string to a new PushDevice object that associates the current django user with a specific device token.

Something went wrong with that request. Please try again.