1 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.db import models
5 from django.contrib.auth.models import User
8 class OAuthConnection(models.Model):
9 user = models.ForeignKey(User, models.CASCADE)
10 access = models.BooleanField(default=False)
11 token = models.CharField(max_length=64, null=True, blank=True)
12 token_secret = models.CharField(max_length=64, null=True, blank=True)
13 beta = models.BooleanField(default=False)
16 def get(cls, user, beta=False):
18 return cls.objects.get(user=user, beta=beta)
19 except cls.DoesNotExist:
20 o = cls(user=user, beta=beta)