From 117d2435774ff9521f9028e472193e7253413106 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 11 Dec 2020 12:31:02 -0800 Subject: [PATCH] Expand site settings and add footer --- bookwyrm/context_processors.py | 8 ++++++ .../migrations/0016_auto_20201211_2026.py | 28 +++++++++++++++++++ bookwyrm/models/site.py | 3 ++ bookwyrm/templates/layout.html | 19 +++++++++++-- 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 bookwyrm/context_processors.py create mode 100644 bookwyrm/migrations/0016_auto_20201211_2026.py diff --git a/bookwyrm/context_processors.py b/bookwyrm/context_processors.py new file mode 100644 index 000000000..72839dcef --- /dev/null +++ b/bookwyrm/context_processors.py @@ -0,0 +1,8 @@ +''' customize the info available in context for rendering templates ''' +from bookwyrm import models + +def site_settings(request): + ''' include the custom info about the site ''' + return { + 'site': models.SiteSettings.objects.get() + } diff --git a/bookwyrm/migrations/0016_auto_20201211_2026.py b/bookwyrm/migrations/0016_auto_20201211_2026.py new file mode 100644 index 000000000..46b6140c3 --- /dev/null +++ b/bookwyrm/migrations/0016_auto_20201211_2026.py @@ -0,0 +1,28 @@ +# Generated by Django 3.0.7 on 2020-12-11 20:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('bookwyrm', '0015_auto_20201128_0349'), + ] + + operations = [ + migrations.AddField( + model_name='sitesettings', + name='admin_email', + field=models.EmailField(blank=True, max_length=255, null=True), + ), + migrations.AddField( + model_name='sitesettings', + name='support_link', + field=models.CharField(blank=True, max_length=255, null=True), + ), + migrations.AddField( + model_name='sitesettings', + name='support_title', + field=models.CharField(blank=True, max_length=100, null=True), + ), + ] diff --git a/bookwyrm/models/site.py b/bookwyrm/models/site.py index aa2e2a675..1577e3696 100644 --- a/bookwyrm/models/site.py +++ b/bookwyrm/models/site.py @@ -17,6 +17,9 @@ class SiteSettings(models.Model): code_of_conduct = models.TextField( default="Add a code of conduct here.") allow_registration = models.BooleanField(default=True) + support_link = models.CharField(max_length=255, null=True, blank=True) + support_title = models.CharField(max_length=100, null=True, blank=True) + admin_email = models.EmailField(max_length=255, null=True, blank=True) @classmethod def get(cls): diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index a363debda..b37c9cda1 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -124,8 +124,23 @@