mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 20:59:47 +02:00
Blacked the code
This commit is contained in:
parent
b6fc0051fa
commit
62ca3bd736
279 changed files with 8861 additions and 9527 deletions
|
@ -12,15 +12,14 @@ from . import nodeinfo
|
|||
from . import stats
|
||||
|
||||
|
||||
NODEINFO_2_CONTENT_TYPE = (
|
||||
'application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8' # noqa
|
||||
)
|
||||
NODEINFO_2_CONTENT_TYPE = "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8" # noqa
|
||||
|
||||
|
||||
class AdminSettings(preferences_viewsets.GlobalPreferencesViewSet):
|
||||
pagination_class = None
|
||||
permission_classes = (HasUserPermission,)
|
||||
required_permissions = ['settings']
|
||||
required_permissions = ["settings"]
|
||||
|
||||
|
||||
class InstanceSettings(views.APIView):
|
||||
permission_classes = []
|
||||
|
@ -29,16 +28,11 @@ class InstanceSettings(views.APIView):
|
|||
def get(self, request, *args, **kwargs):
|
||||
manager = global_preferences_registry.manager()
|
||||
manager.all()
|
||||
all_preferences = manager.model.objects.all().order_by(
|
||||
'section', 'name'
|
||||
)
|
||||
all_preferences = manager.model.objects.all().order_by("section", "name")
|
||||
api_preferences = [
|
||||
p
|
||||
for p in all_preferences
|
||||
if getattr(p.preference, 'show_in_api', False)
|
||||
p for p in all_preferences if getattr(p.preference, "show_in_api", False)
|
||||
]
|
||||
data = serializers.GlobalPreferenceSerializer(
|
||||
api_preferences, many=True).data
|
||||
data = serializers.GlobalPreferenceSerializer(api_preferences, many=True).data
|
||||
return Response(data, status=200)
|
||||
|
||||
|
||||
|
@ -47,8 +41,7 @@ class NodeInfo(views.APIView):
|
|||
authentication_classes = []
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
if not preferences.get('instance__nodeinfo_enabled'):
|
||||
if not preferences.get("instance__nodeinfo_enabled"):
|
||||
return Response(status=404)
|
||||
data = nodeinfo.get()
|
||||
return Response(
|
||||
data, status=200, content_type=NODEINFO_2_CONTENT_TYPE)
|
||||
return Response(data, status=200, content_type=NODEINFO_2_CONTENT_TYPE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue