+ {{ toot.account.display_name }}
+ @{{ toot.account.username }}
+ {{ toot.created_at |naturaltime }}
+
+ {{ toot.content | safe }}
+
diff --git a/brutaldon/forms.py b/brutaldon/forms.py new file mode 100644 index 0000000..c6c3dc9 --- /dev/null +++ b/brutaldon/forms.py @@ -0,0 +1,9 @@ +from django import forms + +class LoginForm(forms.Form): + instance = forms.CharField(label="Instance", + max_length=256) + username = forms.CharField(label="Username", + max_length=256) + password = forms.CharField(widget=forms.PasswordInput()) + diff --git a/brutaldon/migrations/0001_initial.py b/brutaldon/migrations/0001_initial.py new file mode 100644 index 0000000..83207f5 --- /dev/null +++ b/brutaldon/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# Generated by Django 2.0.1 on 2018-04-23 18:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Client', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.TextField(default='brutaldon')), + ('api_base_id', models.URLField(default='mastodon.social')), + ('client_id', models.TextField(blank=True, null=True)), + ('client_secret', models.TextField(blank=True, null=True)), + ], + ), + ] diff --git a/brutaldon/migrations/0002_account.py b/brutaldon/migrations/0002_account.py new file mode 100644 index 0000000..f755886 --- /dev/null +++ b/brutaldon/migrations/0002_account.py @@ -0,0 +1,25 @@ +# Generated by Django 2.0.1 on 2018-04-23 21:34 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('brutaldon', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Account', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('username', models.CharField(max_length=80)), + ('access_token', models.TextField(blank=True, null=True)), + ('django_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/brutaldon/migrations/__init__.py b/brutaldon/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/brutaldon/models.py b/brutaldon/models.py new file mode 100644 index 0000000..a1536ac --- /dev/null +++ b/brutaldon/models.py @@ -0,0 +1,16 @@ +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="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.CharField(max_length=80) + django_user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE, null=True) + access_token = models.TextField(null=True, blank=True) diff --git a/brutaldon/settings.py b/brutaldon/settings.py index ec7b89c..e3c19f8 100644 --- a/brutaldon/settings.py +++ b/brutaldon/settings.py @@ -37,6 +37,9 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'widget_tweaks', + 'django.contrib.humanize', + 'brutaldon', ] MIDDLEWARE = [ diff --git a/brutaldon/templates/base.html b/brutaldon/templates/base.html new file mode 100644 index 0000000..684f0b7 --- /dev/null +++ b/brutaldon/templates/base.html @@ -0,0 +1,26 @@ + + +
+ + ++ My first website with Bulma! +
+ {% endblock %} +
+ {{ toot.account.display_name }}
+ @{{ toot.account.username }}
+ {{ toot.created_at |naturaltime }}
+
+ {{ toot.content | safe }}
+
+ This information is only used to log you in to your instance for the + first time. Brutaldon never stores your username and password; it + only uses it to acquire a token which you can disable from the + settings page of your Mastodon instance. +
+