X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/ce8d791a5298e0cb2569034aec4c8b57afac97b2..bdc2a3ea27e2980c8c0fbdba2efe6b65291692c2:/apps/apiclient/models.py?ds=sidebyside diff --git a/apps/apiclient/models.py b/apps/apiclient/models.py index d3c8f620..64130bc1 100644 --- a/apps/apiclient/models.py +++ b/apps/apiclient/models.py @@ -3,17 +3,18 @@ from django.contrib.auth.models import User class OAuthConnection(models.Model): - user = models.OneToOneField(User) + user = models.ForeignKey(User) access = models.BooleanField(default=False) token = models.CharField(max_length=64, null=True, blank=True) token_secret = models.CharField(max_length=64, null=True, blank=True) + beta = models.BooleanField(default=False) @classmethod - def get(cls, user): + def get(cls, user, beta=False): try: - return cls.objects.get(user=user) + return cls.objects.get(user=user, beta=beta) except cls.DoesNotExist: - o = cls(user=user) + o = cls(user=user, beta=beta) o.save() return o