aboutsummaryrefslogtreecommitdiffstats
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
parentMinor fixes for imports and __init__ files. (diff)
Set up url forwarding for the viewset.
https://github.com/python-discord/site/issues/305
-rw-r--r--Pipfile.lock31
-rw-r--r--pydis_site/apps/api/models/bot/allowlist.py16
-rw-r--r--pydis_site/apps/api/urls.py21
3 files changed, 24 insertions, 44 deletions
diff --git a/Pipfile.lock b/Pipfile.lock
index 097c4f81..9cd105f5 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -21,7 +21,6 @@
"sha256:7e51911ee147dd685c3c8b805c0ad0cb58d360987b56953878f8c06d2d1c6f1a",
"sha256:9fc6fb5d39b8af147ba40765234fa822b39818b12cc80b35ad9b0cef3a476aed"
],
- "markers": "python_version >= '3.5'",
"version": "==3.2.10"
},
"bleach": {
@@ -29,7 +28,6 @@
"sha256:2bce3d8fab545a6528c8fa5d9f9ae8ebc85a56da365c7f85180bfe96a35ef22f",
"sha256:3c4c520fdb9db59ef139915a5db79f8b51bc2a7257ea0389f30c846883430a4b"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==3.1.5"
},
"certifi": {
@@ -51,7 +49,6 @@
"sha256:6687150770438374ab581bb7a1b327a847dd9c5749e396102de3fad4e8a3ef93",
"sha256:f684034d135af4c6cbb949b8a4d2ed61634515257a67299e5f940fbaa34377f5"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==0.6.0"
},
"django": {
@@ -111,7 +108,6 @@
"sha256:90eb236eb4f1a92124bd7c37852bbe09c0d21158477cc237556d59842a91c509",
"sha256:dfdb3af75ad27cdd4458b0544ec8574174f2b90f99bc2cafab6a15b4bc1895a8"
],
- "markers": "python_version >= '3.5'",
"version": "==0.11.0"
},
"django-nyt": {
@@ -155,7 +151,6 @@
"sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6",
"sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.10"
},
"importlib-metadata": {
@@ -189,7 +184,6 @@
"sha256:1fafe3f1ecabfb514a5285fca634a53c1b32a81cb0feb154264d55bf2ff22c17",
"sha256:c467cd6233885534bf0fe96e62e3cf46cfc1605112356c4f9981512b8174de59"
],
- "markers": "python_version >= '3.5'",
"version": "==3.2.2"
},
"oauthlib": {
@@ -197,7 +191,6 @@
"sha256:bee41cc35fcca6e988463cacc3bcb8a96224f470ca547e697b604cc697b2f889",
"sha256:df884cd6cbe20e32633f1db1072e9356f53638e4361bef4e8b03c9127c9328ea"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==3.1.0"
},
"packaging": {
@@ -205,7 +198,6 @@
"sha256:4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8",
"sha256:998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==20.4"
},
"pillow": {
@@ -237,7 +229,6 @@
"sha256:f7e30c27477dffc3e85c2463b3e649f751789e0f6c8456099eea7ddd53be4a8a",
"sha256:ffe538682dc19cc542ae7c3e504fdf54ca7f86fb8a135e59dd6bc8627eae6cce"
],
- "markers": "python_version >= '3.5'",
"version": "==7.2.0"
},
"psycopg2-binary": {
@@ -289,7 +280,6 @@
"sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1",
"sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"
],
- "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.4.7"
},
"python3-openid": {
@@ -353,8 +343,7 @@
"requests-oauthlib": {
"hashes": [
"sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d",
- "sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a",
- "sha256:fa6c47b933f01060936d87ae9327fead68768b69c6c9ea2109c48be30f2d4dbc"
+ "sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a"
],
"version": "==1.3.0"
},
@@ -371,7 +360,6 @@
"sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
"sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.15.0"
},
"sorl-thumbnail": {
@@ -379,7 +367,6 @@
"sha256:66771521f3c0ed771e1ce8e1aaf1639ebff18f7f5a40cfd3083da8f0fe6c7c99",
"sha256:7162639057dff222a651bacbdb6bd6f558fc32946531d541fc71e10c0167ebdf"
],
- "markers": "python_version >= '3.4'",
"version": "==12.6.3"
},
"sqlparse": {
@@ -387,7 +374,6 @@
"sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e",
"sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==0.3.1"
},
"urllib3": {
@@ -395,7 +381,6 @@
"sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527",
"sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==1.25.9"
},
"webencodings": {
@@ -426,7 +411,6 @@
"sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b",
"sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96"
],
- "markers": "python_version >= '3.6'",
"version": "==3.1.0"
}
},
@@ -443,7 +427,6 @@
"sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
"sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==19.3.0"
},
"bandit": {
@@ -458,7 +441,6 @@
"sha256:1ccf53320421aeeb915275a196e23b3b8ae87dea8ac6698b1638001d4a486d53",
"sha256:c8e8f552ffcc6194f4e18dd4f68d9aef0c0d58ae7e7be8c82bee3c5e9edfa513"
],
- "markers": "python_full_version >= '3.6.1'",
"version": "==3.1.0"
},
"coverage": {
@@ -597,7 +579,6 @@
"sha256:91f36bfb1ab7949b3b40e23736db18231bf7593edada2ba5c3a174a7b23657ac",
"sha256:c9e1f2d0db7ddb9a704c2a0217be31214e91a4fe1dea1efad19ae42ba0c285c9"
],
- "markers": "python_version >= '3.4'",
"version": "==4.0.5"
},
"gitpython": {
@@ -605,7 +586,6 @@
"sha256:2db287d71a284e22e5c2846042d0602465c7434d910406990d5b74df4afb0858",
"sha256:fa3b92da728a457dd75d62bb5f3eb2816d99a7fe6c67398e260637a40e3fafb5"
],
- "markers": "python_version >= '3.4'",
"version": "==3.1.7"
},
"identify": {
@@ -613,7 +593,6 @@
"sha256:882c4b08b4569517b5f2257ecca180e01f38400a17f429f5d0edff55530c41c7",
"sha256:f89add935982d5bc62913ceee16c9297d8ff14b226e9d3072383a4e38136b656"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.4.23"
},
"importlib-metadata": {
@@ -666,7 +645,6 @@
"sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367",
"sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.6.0"
},
"pydocstyle": {
@@ -674,7 +652,6 @@
"sha256:da7831660b7355307b32778c4a0dbfb137d89254ef31a2b2978f50fc0b4d7586",
"sha256:f4f5d210610c2d153fae39093d44224c17429e2ad7da12a8b419aba5c2f614b5"
],
- "markers": "python_version >= '3.5'",
"version": "==5.0.2"
},
"pyflakes": {
@@ -682,7 +659,6 @@
"sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92",
"sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.2.0"
},
"pyyaml": {
@@ -707,7 +683,6 @@
"sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
"sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.15.0"
},
"smmap": {
@@ -715,7 +690,6 @@
"sha256:54c44c197c819d5ef1991799a7e30b662d1e520f2ac75c9efbeb54a742214cf4",
"sha256:9c98bbd1f9786d22f14b3d4126894d56befb835ec90cef151af566c7e19b5d24"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==3.0.4"
},
"snowballstemmer": {
@@ -730,7 +704,6 @@
"sha256:79270bd5fb4a052e76932e9fef6e19afa77090c4000f2680eb8c2e887d2e6e36",
"sha256:9fb12884b510fdc25f8a883bb390b8ff82f67863fb360891a33135bcb2ce8c54"
],
- "markers": "python_version >= '3.6'",
"version": "==3.1.0"
},
"toml": {
@@ -780,7 +753,6 @@
"sha256:c11a475400e98450403c0364eb3a2d25d42f71cf1493da64390487b666de4324",
"sha256:e10cc66f40cbda459720dfe1d334c4dc15add0d80f09108224f171006a97a172"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==20.0.26"
},
"zipp": {
@@ -788,7 +760,6 @@
"sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b",
"sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96"
],
- "markers": "python_version >= '3.6'",
"version": "==3.1.0"
}
}
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
)