From 5c48180a7c74c8506a59019759f5be2de8f5ff59 Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Tue, 24 Apr 2018 12:55:44 -0400 Subject: [PATCH] Add client field to Account --- .../migrations/0003_auto_20180424_1255.py | 24 +++++++++++++++++++ brutaldon/models.py | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 brutaldon/migrations/0003_auto_20180424_1255.py diff --git a/brutaldon/migrations/0003_auto_20180424_1255.py b/brutaldon/migrations/0003_auto_20180424_1255.py new file mode 100644 index 0000000..d4b32bb --- /dev/null +++ b/brutaldon/migrations/0003_auto_20180424_1255.py @@ -0,0 +1,24 @@ +# Generated by Django 2.0.4 on 2018-04-24 16:55 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('brutaldon', '0002_account'), + ] + + operations = [ + migrations.AddField( + model_name='account', + name='client', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='brutaldon.Client'), + ), + migrations.AlterField( + model_name='client', + name='api_base_id', + field=models.URLField(default='https://mastodon.social'), + ), + ] diff --git a/brutaldon/models.py b/brutaldon/models.py index a1536ac..240e298 100644 --- a/brutaldon/models.py +++ b/brutaldon/models.py @@ -3,7 +3,7 @@ from django.conf import settings class Client(models.Model): name = models.TextField(default = "brutaldon") - api_base_id = models.URLField(default="mastodon.social") + 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) @@ -14,3 +14,4 @@ class Account(models.Model): username = models.CharField(max_length=80) 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)