feat(settings): Allow moderators to set moderation languages
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2604>
This commit is contained in:
parent
523245d035
commit
1a0596b102
5 changed files with 33 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import pycountry
|
||||
from dynamic_preferences import types
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
from rest_framework import serializers
|
||||
|
|
@ -92,3 +93,18 @@ class SignupFormCustomization(common_preferences.SerializedPreference):
|
|||
required = False
|
||||
default = {}
|
||||
data_serializer_class = CustomFormSerializer
|
||||
|
||||
|
||||
@global_preferences_registry.register
|
||||
class Languages(common_preferences.StringListPreference):
|
||||
show_in_api = True
|
||||
section = moderation
|
||||
name = "languages"
|
||||
default = ["en"]
|
||||
verbose_name = "Moderation languages"
|
||||
help_text = (
|
||||
"The language(s) spoken by the server moderator(s). Set this to inform users "
|
||||
"what languages they should write reports and requests in."
|
||||
)
|
||||
choices = [(lang.alpha_3, lang.name) for lang in pycountry.languages]
|
||||
field_kwargs = {"choices": choices, "required": False}
|
||||
|
|
|
|||
15
api/poetry.lock
generated
15
api/poetry.lock
generated
|
|
@ -2725,6 +2725,19 @@ files = [
|
|||
{file = "pycodestyle-2.7.0.tar.gz", hash = "sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pycountry"
|
||||
version = "22.3.5"
|
||||
description = "ISO country, subdivision, language, currency and script definitions and their translations"
|
||||
optional = false
|
||||
python-versions = ">=3.6, <4"
|
||||
files = [
|
||||
{file = "pycountry-22.3.5.tar.gz", hash = "sha256:b2163a246c585894d808f18783e19137cb70a0c18fb36748dc01fc6f109c1646"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
setuptools = "*"
|
||||
|
||||
[[package]]
|
||||
name = "pycparser"
|
||||
version = "2.21"
|
||||
|
|
@ -4536,4 +4549,4 @@ typesense = ["typesense"]
|
|||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.8,<3.12"
|
||||
content-hash = "89defcf9df569a1d3e2cdb50b29fd9161288dc88daa8c3e0e574ace88d196db2"
|
||||
content-hash = "5a259657d79f98ce6a7c377c5715aaf6f56d7ad4b9c420e784c81aa145c86b1d"
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ watchdog = "==2.2.1"
|
|||
troi = { git = "https://github.com/metabrainz/troi-recommendation-playground.git", tag = "v-2023-10-30.0"}
|
||||
lb-matching-tools = { git = "https://github.com/metabrainz/listenbrainz-matching-tools.git", branch = "main"}
|
||||
unidecode = "==1.3.6"
|
||||
pycountry = "22.3.5"
|
||||
|
||||
# Typesense
|
||||
typesense = { version = "==0.15.1", optional = true }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue