aboutsummaryrefslogtreecommitdiffstats
path: root/api/models.py
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2019-02-07 21:59:42 +0100
committerGravatar Johannes Christ <[email protected]>2019-02-07 21:59:42 +0100
commit68d1d75d19df39c018578b8928c36547bfca7304 (patch)
tree72c97df17a5e3bf069cd53b487a47ba94f431850 /api/models.py
parentDefine proper update method. (diff)
Add a bot setting model.
Diffstat (limited to 'api/models.py')
-rw-r--r--api/models.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/api/models.py b/api/models.py
index fa68f31c..86c99f86 100644
--- a/api/models.py
+++ b/api/models.py
@@ -5,7 +5,7 @@ from django.core.validators import MaxValueValidator, MinValueValidator, RegexVa
from django.db import models
from django.utils import timezone
-from .validators import validate_tag_embed
+from .validators import validate_bot_setting_name, validate_tag_embed
class ModelReprMixin:
@@ -27,6 +27,19 @@ class ModelReprMixin:
return f'<{self.__class__.__name__}({attributes})>'
+class BotSetting(ModelReprMixin, models.Model):
+ """A configuration entry for the bot."""
+
+ name = models.CharField(
+ primary_key=True,
+ max_length=50,
+ validators=(validate_bot_setting_name,)
+ )
+ data = pgfields.JSONField(
+ help_text="The actual settings of this setting."
+ )
+
+
class DocumentationLink(ModelReprMixin, models.Model):
"""A documentation link used by the `!docs` command of the bot."""