aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps
diff options
context:
space:
mode:
authorGravatar Akarys42 <[email protected]>2019-10-19 12:38:18 +0200
committerGravatar Akarys42 <[email protected]>2019-10-19 12:38:18 +0200
commit71b40842ddf9c72d34921cae0c294bcc9f0c4672 (patch)
treed3d7f20cedabb319ed1dfe87a710532b5f58b08e /pydis_site/apps
parentAdd Code of Conduct to navbar submenu (diff)
Add a jump-url field in the reminder model
Diffstat (limited to 'pydis_site/apps')
-rw-r--r--pydis_site/apps/api/models/bot/reminder.py5
-rw-r--r--pydis_site/apps/api/serializers.py2
-rw-r--r--pydis_site/apps/api/tests/test_models.py4
3 files changed, 10 insertions, 1 deletions
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)
)