1 from django.db import models
2 from django.contrib.auth.models import User
5 class OAuthConnection(models.Model):
6 user = models.ForeignKey(User, models.CASCADE)
7 access = models.BooleanField(default=False)
8 token = models.CharField(max_length=64, null=True, blank=True)
9 token_secret = models.CharField(max_length=64, null=True, blank=True)
10 beta = models.BooleanField(default=False)
13 def get(cls, user, beta=False):
15 return cls.objects.get(user=user, beta=beta)
16 except cls.DoesNotExist:
17 o = cls(user=user, beta=beta)