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')
```

Release files for django-parse-push 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-parse-push 0.2
File Size Uploaded
django-parse-push-0.2.tar.gz 8.0 kB Details

Release files / django-parse-push-0.2.tar.gz

Download URL django-parse-push-0.2.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8f2841e2e4a692750cf37a702bf5a612042ad0edd3f72dab6aef1d8b53e6b7dc
BLAKE2b-256 checksum
How to use checksums
308069dc5e5c1a4a77ef6583a9acc47539af1b42a32d4fd3c6dc3b2021d741d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page