Skip to content

Instantly share code, notes, and snippets.

@erangaeb
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erangaeb/6950615e55d8994b4b01 to your computer and use it in GitHub Desktop.
Save erangaeb/6950615e55d8994b4b01 to your computer and use it in GitHub Desktop.
from django.db import models
from django.contrib.auth.models import User
class Device(models.Model):
"""
Model class to keep google could messaging enable device details
Need to keep device registration id as well as active state. There's a
REST api to deal with these devices. API doing registering and
un-registering devices
When registering create a Device with is_active True,
when un-registering update value of is_active to False
"""
name = models.CharField(max_length=64, null=True, blank=True)
device_id = models.CharField(max_length=64, unique=True)
reg_id = models.TextField()
created_date = models.DateTimeField()
modified_date = models.DateTimeField(null=True, blank=True)
is_active = models.BooleanField(default=False)
user = models.ForeignKey(User)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment