Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #30 from Fueled/user_token_unique
Browse files Browse the repository at this point in the history
fix(models):make user and token unique
  • Loading branch information
glemmaPaul committed Jun 9, 2015
2 parents 171e191 + ce3e58f commit 3c06f47
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion push_notifications/__init__.py
@@ -1 +1 @@
__version__ = '0.1.3'
__version__ = '0.1.4'
18 changes: 18 additions & 0 deletions push_notifications/migrations/0002_auto_20150528_1115.py
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('push_notifications', '0001_initial'),
]

operations = [
migrations.AlterUniqueTogether(
name='pushdevice',
unique_together=set([('user', 'token')]),
),
]
3 changes: 3 additions & 0 deletions push_notifications/models.py
Expand Up @@ -55,6 +55,9 @@ class PushDevice(models.Model):

objects = PushDeviceManager()

class Meta:
unique_together = ('user', 'token')

def add_permissions(self, notice_types):
""" Adds a permission to the push device """
PushDevice.change_permissions(notice_types, self, send=True)
Expand Down

0 comments on commit 3c06f47

Please sign in to comment.