From 656c2b01aac528d415326100add7e1305eb9054a Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Wed, 20 Jul 2022 15:58:01 -0600 Subject: [PATCH] Updates and fixes --- src/core/forms.py | 3 +- .../migrations/0006_alter_post_recipients.py | 20 +++++++ src/core/models.py | 2 + src/static/styles/main.css | 52 +++++++++++++++++-- src/templates/base.html | 2 +- 5 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 src/core/migrations/0006_alter_post_recipients.py diff --git a/src/core/forms.py b/src/core/forms.py index d5466c9..ed2a5fc 100644 --- a/src/core/forms.py +++ b/src/core/forms.py @@ -28,7 +28,8 @@ class CommentCreateForm(forms.ModelForm): message = self.cleaned_data.get('content') post = Post.objects.get(pk=self.cleaned_data['object_id']) recipients = list(post.recipients.all().values_list('email', flat=True)) - recipients.remove(author.email) + if author in recipients: + recipients.remove(author.email) send_mail( post.title, diff --git a/src/core/migrations/0006_alter_post_recipients.py b/src/core/migrations/0006_alter_post_recipients.py new file mode 100644 index 0000000..70e8284 --- /dev/null +++ b/src/core/migrations/0006_alter_post_recipients.py @@ -0,0 +1,20 @@ +# Generated by Django 4.0.6 on 2022-07-20 21:37 + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('core', '0005_post_recipients'), + ] + + operations = [ + migrations.AlterField( + model_name='post', + name='recipients', + field=models.ManyToManyField(blank=True, null=True, related_name='subscriptions', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/src/core/models.py b/src/core/models.py index 6ce3379..e405cf3 100644 --- a/src/core/models.py +++ b/src/core/models.py @@ -129,6 +129,8 @@ class Post(models.Model): comments = GenericRelation(Comment, related_query_name='parent') recipients = models.ManyToManyField( User, + blank=True, + null=True, related_name='subscriptions' ) tags = GenericRelation(Tag) diff --git a/src/static/styles/main.css b/src/static/styles/main.css index 671085f..dc863df 100644 --- a/src/static/styles/main.css +++ b/src/static/styles/main.css @@ -125,7 +125,8 @@ tbody tr.has-link { textarea { box-sizing: border-box; font: inherit; - font-size: 1.25rem; + font-family: 'PT Mono', monospace; + font-size: 2rem; padding: 0.5rem 1rem; width: 100%; resize: vertical; @@ -134,6 +135,7 @@ textarea { button, +input[type=submit], .action-button { cursor: pointer; border: none; @@ -248,8 +250,41 @@ main { } .post__content { font-family: 'STIX Two Text'; - font-size: 200%; + font-size: 2rem; margin-bottom: 4rem; + line-height: 1.75; +} + +.post__content h1, +.post__content h2, +.post__content h3, +.post__content h4, +.post__content h5 { + font-family: 'STIX Two Text'; + text-transform: unset; + margin: 2em 0 1em; +} + +.post__content h1 { + font-size: 1.802em; +} +.post__content h2 { + font-size: 1.602em; +} +.post__content h3 { + font-size: 1.424em; +} +.post__content h4 { + font-size: 1.266em; +} +.post__content h5 { + font-size: 1.125em; +} + +.post__content blockquote { + padding: 0.5rem 1rem; + margin: 0 0 1rem; + padding-left: 3rem; } @@ -270,7 +305,7 @@ main { .comment__content { font-family: 'STIX Two Text'; - font-size: 200%; + font-size: 2rem; /*max-width: 64ch;*/ } @@ -300,6 +335,13 @@ main { font-size: 1.125em; } +.comment__content blockquote { + font-size: 1.75rem; + padding: 0.5rem 1rem; + margin: 0 0 1rem; + padding: 0 5rem; +} + .comment p { line-height: 1.75; } @@ -309,7 +351,7 @@ main { .comments__form textarea { - font-family: 'STIX Two Text'; - font-size: 200%; + font-family: 'PT Mono'; + font-size: 2rem; line-height: 1.75; } diff --git a/src/templates/base.html b/src/templates/base.html index 16aaff6..b63dfb6 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -11,7 +11,7 @@ - + {% compress css %}