from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ class MastodonApplication(models.Model): domain_name = models.CharField(_('site domain name'), max_length=100, unique=True) app_id = models.PositiveIntegerField(_('in-site app id')) client_id = models.CharField(_('client id'), max_length=100) client_secret = models.CharField(_('client secret'), max_length=100) vapid_key = models.CharField(_('vapid key'), max_length=200) is_proxy = models.BooleanField(default=False, blank=True) proxy_to = models.CharField(max_length=100, blank=True, default='') # website # name # redirect_uris def __str__(self): return self.domain_name class CrossSiteUserInfo(models.Model): # username@original_site uid = models.CharField(_("username and original site"), max_length=200) # pk in the boofilsic db local_id = models.PositiveIntegerField(_("local database id")) # target site domain name target_site = models.CharField(_("target site domain name"), max_length=100) # target site id site_id = models.PositiveIntegerField() class Meta: constraints = [ models.UniqueConstraint( fields=['uid', 'target_site'], name="unique_cross_site_user_info") ]