Skip to main content
# django-parse-push #

A simple Django library for pushing notifications thru Parse.

---

**Comes out of the box with**

* Django REST Framework endpoint for registering a device token thru REST
* Basic tests

## Installation ##

1) Install thru PIP

pip install django-parse-push

2) Add `parse_push` to `settings.INSTALLED_APPS`

```python
INSTALLED_APPS = (
# ...,
parse_push,
)
```

3) Run migrations

python manage.py migrate parse_push

4) Add environment vars

```bash
PARSE_APPLICATION_ID=your_parse_application_id
PARSE_REST_API_KEY=your_parse_api_key

# Optional environment vars
PARSE_API_URL=https://api.parse.com
PARSE_API_VERSION=1
```

5) Add REST endpoint to urls.py

```python
from django.conf.urls import patterns, include, url

urlpatterns = patterns('',

# ...

(r'^api/v1/parse-push', include('parse_push.urls')),

# ...
)
```

## Usage ##

###Example 1###
*A simple Django based example*

```python
from django.contrib.auth import get_user_model

User = get_user_model()
user = User.objects.get(email='donald@duck.com')
device = user.device_set.get_latest('created_at')
device.push({'alert': 'Hello World!', 'text': 'Lorem ipsum dolor...'})
```

###Example 2###
*With Django based User model*

```python
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin

class User(AbstractBaseUser, PermissionsMixin)

# ...

def get_full_name(self):
""" Returns the full name """
full_name = u"{} {}".format(self.first_name, self.last_name)
return full_name.strip()

def push(self, data):
device = self.device_set.get_latest()
return device.push(data)
```

###Example 3###
*Barebone client, no dependency on Django*

```python
from parse_push.client import get_client

client = get_client()
client.push('ios', 'devicetokenabcdefghijklmnopqstruvwxyz0123456789', {'foo': 'bar'})
```

You can also configure a Client instance with `APPLICATION_ID` and `REST_API_KEY`

```python
client = Client(application_id='applicationidabcdefghijklmn0123456789', rest_api_key='restapikeyabcdefghijklmn0123456789')
```

Download files

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

Source Distribution

django-parse-push-0.2.tar.gz (8.0 kB view details)

Uploaded Source

File details

Details for the file django-parse-push-0.2.tar.gz.

File metadata

File hashes

Hashes for django-parse-push-0.2.tar.gz
Algorithm Hash digest
SHA256 8f2841e2e4a692750cf37a702bf5a612042ad0edd3f72dab6aef1d8b53e6b7dc
MD5 435f8ce490366ca5d7778a137a1507d7
BLAKE2b-256 308069dc5e5c1a4a77ef6583a9acc47539af1b42a32d4fd3c6dc3b2021d741d7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2 This release

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

Supported by

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