Commits

Jesper Nøhr  committed 1b484de

can now create self-signed access tokens, integrated into templates too

  • Participants
  • Parent commits 76c0ea5

Comments (0)

Files changed (1)

File piston/models.py

 import urllib
 from django.db import models
 from django.contrib.auth.models import User
+from django.contrib import admin
 
 from managers import TokenManager, ConsumerManager, ResourceManager
 
     def __unicode__(self):
         return u"Nonce %s for %s" % (self.key, self.consumer_key)
 
+admin.site.register(Nonce)
 
 class Resource(models.Model):
     name = models.CharField(max_length=255)
     def __unicode__(self):
         return u"Resource %s with url %s" % (self.name, self.url)
 
+admin.site.register(Resource)
 
 class Consumer(models.Model):
     name = models.CharField(max_length=255)
         self.secret = secret
         self.save()
 
+admin.site.register(Consumer)
 
 class Token(models.Model):
     REQUEST = 1
     timestamp = models.IntegerField()
     is_approved = models.BooleanField(default=False)
     
-    user = models.ForeignKey(User, null=True, blank=True)
+    user = models.ForeignKey(User, null=True, blank=True, related_name='tokens')
     consumer = models.ForeignKey(Consumer)
-#    resource = models.ForeignKey(Resource)
     
     objects = TokenManager()
     
 
         self.key = key
         self.secret = secret
-        self.save()
+        self.save()
+        
+admin.site.register(Token)