2
0
mirror of https://github.com/jfmcbrayer/brutaldon synced 2024-12-23 21:51:43 +01:00
brutaldon-interfaccia-web-m.../brutaldon/models.py
Jason McBrayer 267e94077f Add multiuser support
Currently, this uses anonymous sessions. You log in to your instance, and you
get associated with a session. Your client information and account information
are persisted (created only if needed, reattached if not). Passwords are never
stored, only access tokens.
2018-04-24 14:53:05 -04:00

18 lines
681 B
Python

from django.db import models
from django.conf import settings
class Client(models.Model):
name = models.TextField(default = "brutaldon")
api_base_id = models.URLField(default="https://mastodon.social")
client_id = models.TextField(null=True, blank=True)
client_secret = models.TextField(null=True, blank=True)
def __str__(self):
return self.name + ": " + self.api_base_id
class Account(models.Model):
username = models.EmailField()
django_user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True)
access_token = models.TextField(null=True, blank=True)
client= models.ForeignKey(Client, models.SET_NULL, null=True)