diff options
Diffstat (limited to 'pydis_site/apps/api/models')
-rw-r--r-- | pydis_site/apps/api/models/__init__.py | 2 | ||||
-rw-r--r-- | pydis_site/apps/api/models/bot/__init__.py | 2 | ||||
-rw-r--r-- | pydis_site/apps/api/models/bot/allow_deny_list.py (renamed from pydis_site/apps/api/models/bot/allowlist.py) | 18 |
3 files changed, 10 insertions, 12 deletions
diff --git a/pydis_site/apps/api/models/__init__.py b/pydis_site/apps/api/models/__init__.py index 2839fbba..34973a8d 100644 --- a/pydis_site/apps/api/models/__init__.py +++ b/pydis_site/apps/api/models/__init__.py @@ -1,6 +1,6 @@ # flake8: noqa from .bot import ( - AllowList, + AllowDenyList, BotSetting, DocumentationLink, DeletedMessage, diff --git a/pydis_site/apps/api/models/bot/__init__.py b/pydis_site/apps/api/models/bot/__init__.py index b373ee84..1234b35a 100644 --- a/pydis_site/apps/api/models/bot/__init__.py +++ b/pydis_site/apps/api/models/bot/__init__.py @@ -1,5 +1,5 @@ # flake8: noqa -from .allowlist import AllowList +from .allow_deny_list import AllowDenyList from .bot_setting import BotSetting from .deleted_message import DeletedMessage from .documentation_link import DocumentationLink diff --git a/pydis_site/apps/api/models/bot/allowlist.py b/pydis_site/apps/api/models/bot/allow_deny_list.py index fc57ef32..1eef47ba 100644 --- a/pydis_site/apps/api/models/bot/allowlist.py +++ b/pydis_site/apps/api/models/bot/allow_deny_list.py @@ -3,11 +3,11 @@ from django.db import models from pydis_site.apps.api.models.mixins import ModelReprMixin, ModelTimestampMixin -class AllowList(ModelTimestampMixin, ModelReprMixin, models.Model): +class AllowDenyList(ModelTimestampMixin, ModelReprMixin, models.Model): """An item that is either allowed or denied.""" - AllowListType = models.TextChoices( - 'AllowListType', + AllowDenyListType = models.TextChoices( + 'AllowDenyListType', 'GUILD_INVITE_ID ' 'FILE_FORMAT ' 'DOMAIN_NAME ' @@ -16,24 +16,22 @@ class AllowList(ModelTimestampMixin, ModelReprMixin, models.Model): type = models.CharField( max_length=50, help_text="The type of allowlist this is on.", - choices=AllowListType.choices, + choices=AllowDenyListType.choices, ) allowed = models.BooleanField( help_text="Whether this item is on the allowlist or the denylist." ) content = models.TextField( - help_text="The data to add to the allowlist." + help_text="The data to add to the allow or denylist." ) class Meta: """Metaconfig for this model.""" - db_table = 'allow_list' - - # This constraint ensures only one allowlist with the same content - # can exist per type.This means that we cannot have both an allow + # This constraint ensures only one allow or denylist with the + # same content can exist. This means that we cannot have both an allow # and a deny for the same item, and we cannot have duplicates of the # same item. constraints = [ - models.UniqueConstraint(fields=['content', 'type'], name='unique_allowlist'), + models.UniqueConstraint(fields=['content', 'type'], name='unique_allow_deny_list'), ] |