aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/models.py
diff options
context:
space:
mode:
authortom christie tom@tomchristie.com2011-03-03 09:02:41 +0000
committertom christie tom@tomchristie.com2011-03-03 09:02:41 +0000
commit60206e5288d78d1a5e2eccd799350bf96fc27d85 (patch)
tree0d61e286712503d500db86a6979dc45533c86064 /djangorestframework/models.py
parentaad7eacce6ed894c84b0b49567eaccbbe6bf0813 (diff)
downloaddjango-rest-framework-60206e5288d78d1a5e2eccd799350bf96fc27d85.tar.bz2
./examples/modelresourceexample/models.py
Diffstat (limited to 'djangorestframework/models.py')
-rw-r--r--djangorestframework/models.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/djangorestframework/models.py b/djangorestframework/models.py
index 72d239e5..e5e9101b 100644
--- a/djangorestframework/models.py
+++ b/djangorestframework/models.py
@@ -1 +1,19 @@
-# Just to keep things like ./manage.py test happy \ No newline at end of file
+""""""
+from django.db import models
+from django.contrib.auth import Permission, User
+
+class PermissionSet(models.Model):
+ """"""
+ name = models.CharField(unique=True, max_length=64)
+ description = models.CharField(max_length=512)
+ permissions = models.ManyToManyField(Permission, blank=True)
+
+
+class UserToken(models.Model):
+ """"""
+ token_key = models.CharField(max_length=30, unique=True)
+ token_secret = models.CharField(max_length=256)
+ user = models.ForeignKey(User)
+ permission_set = models.ForeignKey(PermissionSet, null=True, blank=True, help_text="If set then determines the subset of permissions that are granted by this token, rathen than granting full user permissions.")
+ expiry = models.DateTimeField(default=None, blank=True, null=True, help_text="If set then determines when the token will no longer be treated as valid. If left empty the token will not expire.")
+ is_active = models.BooleanField(default=True)