aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2018-11-18 21:19:42 +0100
committerGravatar Johannes Christ <[email protected]>2018-11-18 21:19:42 +0100
commit2001d123aa96bc5b7f07f5be48e4e8a32372c480 (patch)
treeab9a4abefff31098ae73371035de6a912050e312 /api
parentAdd the `MessageDeletionContext` model. (diff)
Add the `channel_id` field to messages.
Diffstat (limited to 'api')
-rw-r--r--api/models.py12
-rw-r--r--api/tests/test_models.py1
2 files changed, 13 insertions, 0 deletions
diff --git a/api/models.py b/api/models.py
index bb3489d0..abbaa8bc 100644
--- a/api/models.py
+++ b/api/models.py
@@ -226,6 +226,18 @@ class Message(ModelReprMixin, models.Model):
on_delete=models.CASCADE,
help_text="The author of this message."
)
+ channel_id = models.BigInteger(
+ help_text=(
+ "The channel ID that this message was "
+ "sent in, taken from Discord."
+ ),
+ validators=(
+ MinValueValidator(
+ limit_value=0,
+ message="Channel IDs cannot be negative."
+ ),
+ )
+ )
content = models.CharField(
max_length=2_000,
help_text="The content of this message, taken from Discord."
diff --git a/api/tests/test_models.py b/api/tests/test_models.py
index 92a59f46..b36f29b9 100644
--- a/api/tests/test_models.py
+++ b/api/tests/test_models.py
@@ -50,6 +50,7 @@ class StringDunderMethodTests(SimpleTestCase):
id=444, name='bill',
discriminator=5, avatar_hash=None
),
+ channel_id=666,
content="wooey",
embeds=[]
),