From 71b40842ddf9c72d34921cae0c294bcc9f0c4672 Mon Sep 17 00:00:00 2001 From: Akarys42 Date: Sat, 19 Oct 2019 12:38:18 +0200 Subject: Add a jump-url field in the reminder model --- pydis_site/apps/api/models/bot/reminder.py | 5 +++++ pydis_site/apps/api/serializers.py | 2 +- pydis_site/apps/api/tests/test_models.py | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pydis_site/apps/api/models/bot/reminder.py b/pydis_site/apps/api/models/bot/reminder.py index decc9391..026d3a3a 100644 --- a/pydis_site/apps/api/models/bot/reminder.py +++ b/pydis_site/apps/api/models/bot/reminder.py @@ -15,6 +15,11 @@ class Reminder(ModelReprMixin, models.Model): "If not, it has been sent out to the user." ) ) + jump_url = models.CharField( + help_text=( + "The jump url to the message that created the reminder" + ) + ) author = models.ForeignKey( User, on_delete=models.CASCADE, diff --git a/pydis_site/apps/api/serializers.py b/pydis_site/apps/api/serializers.py index 326e20e1..8a605612 100644 --- a/pydis_site/apps/api/serializers.py +++ b/pydis_site/apps/api/serializers.py @@ -190,7 +190,7 @@ class ReminderSerializer(ModelSerializer): """Metadata defined for the Django REST Framework.""" model = Reminder - fields = ('active', 'author', 'channel_id', 'content', 'expiration', 'id') + fields = ('active', 'author', 'jump_url', 'channel_id', 'content', 'expiration', 'id') class RoleSerializer(ModelSerializer): diff --git a/pydis_site/apps/api/tests/test_models.py b/pydis_site/apps/api/tests/test_models.py index bce76942..b4a766d0 100644 --- a/pydis_site/apps/api/tests/test_models.py +++ b/pydis_site/apps/api/tests/test_models.py @@ -115,6 +115,10 @@ class StringDunderMethodTests(SimpleTestCase): discriminator=5, avatar_hash=None ), channel_id=555, + jump_url=( + 'https://discordapp.com/channels/' + '267624335836053506/291284109232308226/463087129459949587' + ), content="oh no", expiration=dt(5018, 11, 20, 15, 52, tzinfo=timezone.utc) ) -- cgit v1.2.3 From 2d20f4ab8d3202e668e3e78c4bb6e8b6703ef5f9 Mon Sep 17 00:00:00 2001 From: Akarys42 Date: Sat, 19 Oct 2019 13:22:27 +0200 Subject: Add max_lengh for reminder.jump_url --- pydis_site/apps/api/models/bot/reminder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pydis_site/apps/api/models/bot/reminder.py b/pydis_site/apps/api/models/bot/reminder.py index 026d3a3a..3b174252 100644 --- a/pydis_site/apps/api/models/bot/reminder.py +++ b/pydis_site/apps/api/models/bot/reminder.py @@ -16,6 +16,7 @@ class Reminder(ModelReprMixin, models.Model): ) ) jump_url = models.CharField( + max_length=88, help_text=( "The jump url to the message that created the reminder" ) -- cgit v1.2.3 From 9e588d2c3ddfc79cc275b5dd8fbe8aa89b99ba16 Mon Sep 17 00:00:00 2001 From: scragly <29337040+scragly@users.noreply.github.com> Date: Mon, 21 Oct 2019 00:11:23 +1000 Subject: Add bulma content class to home page content for proper formatting. --- pydis_site/templates/home/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 0fa2f67c..dfcc6715 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -16,7 +16,7 @@

Who are we?


-
+

We're a large community focused around the Python programming language. We believe anyone can learn to code, and are very dedicated to helping -- cgit v1.2.3 From 967a948248928189a1d321d7e727de4c387bafdf Mon Sep 17 00:00:00 2001 From: Benjamin Soyka Date: Sun, 20 Oct 2019 15:32:46 -0700 Subject: Remove breadcrumb truncation As per discussion in #meta --- pydis_site/templates/wiki/includes/breadcrumbs.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pydis_site/templates/wiki/includes/breadcrumbs.html b/pydis_site/templates/wiki/includes/breadcrumbs.html index 791beb90..1b268e11 100644 --- a/pydis_site/templates/wiki/includes/breadcrumbs.html +++ b/pydis_site/templates/wiki/includes/breadcrumbs.html @@ -10,13 +10,13 @@ {# Continue, we don't want to show the root element #} {% else %}

  • - {{ ancestor.article.current_revision.title|truncatechars:25 }} + {{ ancestor.article.current_revision.title }}
  • {% endif %} {% endfor %}
  • - {{ article.current_revision.title|truncatechars:25 }} + {{ article.current_revision.title }}
  • -- cgit v1.2.3 From 8ea0a1dc088d1ff0b5cfc2c79d01d4559580bf9a Mon Sep 17 00:00:00 2001 From: Akarys42 Date: Mon, 21 Oct 2019 16:42:23 +0200 Subject: Change reminder.jump_url field to URLField This make sure that the data receivied is valid --- pydis_site/apps/api/models/bot/reminder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/apps/api/models/bot/reminder.py b/pydis_site/apps/api/models/bot/reminder.py index 3b174252..d53fedb5 100644 --- a/pydis_site/apps/api/models/bot/reminder.py +++ b/pydis_site/apps/api/models/bot/reminder.py @@ -15,7 +15,7 @@ class Reminder(ModelReprMixin, models.Model): "If not, it has been sent out to the user." ) ) - jump_url = models.CharField( + jump_url = models.URLField( max_length=88, help_text=( "The jump url to the message that created the reminder" -- cgit v1.2.3 From b4bdf501dea18e7d519ce65d92c4ae1c1ca23f5d Mon Sep 17 00:00:00 2001 From: Akarys42 Date: Mon, 21 Oct 2019 16:47:41 +0200 Subject: Add migrations for the reminder model --- .../apps/api/migrations/0046_reminder_jump_url.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pydis_site/apps/api/migrations/0046_reminder_jump_url.py diff --git a/pydis_site/apps/api/migrations/0046_reminder_jump_url.py b/pydis_site/apps/api/migrations/0046_reminder_jump_url.py new file mode 100644 index 00000000..b145f0dd --- /dev/null +++ b/pydis_site/apps/api/migrations/0046_reminder_jump_url.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.6 on 2019-10-21 14:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0045_add_plural_name_for_log_entry'), + ] + + operations = [ + migrations.AddField( + model_name='reminder', + name='jump_url', + field=models.URLField(default='', help_text='The jump url to the message that created the reminder', max_length=88), + preserve_default=False, + ), + ] -- cgit v1.2.3 From a6313b8fb4cf14f566f55c710533636b7e29ed7b Mon Sep 17 00:00:00 2001 From: Sebastiaan Zeeff <33516116+SebastiaanZ@users.noreply.github.com> Date: Tue, 22 Oct 2019 19:29:31 +0200 Subject: Set SECRET_KEY to constant in debug mode The SECRET_KEY in debug mode was auto-generated each time the config file was loaded. This had the unwanted side-effect of requiring testers to login again on the site as the SECRET_KEY had changed during the reload process. This commit resolves that by turning it into a constant. Since having a constant secret results in the linting error `S105`, I have added a specific `noqa` ignore for that. --- pydis_site/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydis_site/settings.py b/pydis_site/settings.py index 56ac0a1d..94718ec7 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -48,7 +48,7 @@ if DEBUG: 'staff.web' ] ) - SECRET_KEY = secrets.token_urlsafe(32) + SECRET_KEY = "yellow polkadot bikini" # noqa: S105 elif 'CI' in os.environ: ALLOWED_HOSTS = ['*'] -- cgit v1.2.3