aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2020-07-15 14:29:32 +0200
committerGravatar Leon Sandøy <[email protected]>2020-07-15 14:29:32 +0200
commitd03ac5fbf06bc3749e68a606601c0b793f1f0766 (patch)
tree251e48be9ee07c05e43128e158ff6887d1a76b30 /pydis_site
parentMinor fixes for imports and __init__ files. (diff)
Set up url forwarding for the viewset.
https://github.com/python-discord/site/issues/305
Diffstat (limited to 'pydis_site')
-rw-r--r--pydis_site/apps/api/models/bot/allowlist.py16
-rw-r--r--pydis_site/apps/api/urls.py21
2 files changed, 23 insertions, 14 deletions
diff --git a/pydis_site/apps/api/models/bot/allowlist.py b/pydis_site/apps/api/models/bot/allowlist.py
index c8fa2e33..b0aea066 100644
--- a/pydis_site/apps/api/models/bot/allowlist.py
+++ b/pydis_site/apps/api/models/bot/allowlist.py
@@ -1,23 +1,21 @@
from django.db import models
-from pydis_site.apps.api.models import ModelReprMixin, ModelTimestampMixin
+from pydis_site.apps.api.models.mixins import ModelReprMixin, ModelTimestampMixin
class AllowList(ModelTimestampMixin, ModelReprMixin, models.Model):
"""An item that is either allowed or denied."""
AllowListType = models.TextChoices(
- 'guild_invite_id',
- 'file_format',
- 'domain_name',
- 'word_watchlist',
+ 'AllowListType',
+ 'GUILD_INVITE_ID '
+ 'FILE_FORMAT '
+ 'DOMAIN_NAME '
+ 'WORD_WATCHLIST '
)
type = models.CharField(
max_length=50,
- help_text=(
- "The type of allowlist this is on. The value must be one of the following: "
- f"{','.join(AllowListType.choices)}."
- ),
+ help_text="The type of allowlist this is on.",
choices=AllowListType.choices,
)
allowed = models.BooleanField(
diff --git a/pydis_site/apps/api/urls.py b/pydis_site/apps/api/urls.py
index 3bb5198e..bf41f09f 100644
--- a/pydis_site/apps/api/urls.py
+++ b/pydis_site/apps/api/urls.py
@@ -3,18 +3,29 @@ from rest_framework.routers import DefaultRouter
from .views import HealthcheckView, RulesView
from .viewsets import (
- BotSettingViewSet, DeletedMessageViewSet,
- DocumentationLinkViewSet, InfractionViewSet,
- LogEntryViewSet, NominationViewSet,
+ AllowListViewSet,
+ BotSettingViewSet,
+ DeletedMessageViewSet,
+ DocumentationLinkViewSet,
+ InfractionViewSet,
+ LogEntryViewSet,
+ NominationViewSet,
OffTopicChannelNameViewSet,
- OffensiveMessageViewSet, ReminderViewSet,
- RoleViewSet, TagViewSet, UserViewSet
+ OffensiveMessageViewSet,
+ ReminderViewSet,
+ RoleViewSet,
+ TagViewSet,
+ UserViewSet
)
# http://www.django-rest-framework.org/api-guide/routers/#defaultrouter
bot_router = DefaultRouter(trailing_slash=False)
bot_router.register(
+ 'allowlists',
+ AllowListViewSet
+)
+bot_router.register(
'bot-settings',
BotSettingViewSet
)