-
Notifications
You must be signed in to change notification settings - Fork 27
/
api.py
28 lines (21 loc) · 817 Bytes
/
api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from rest_framework import viewsets
from orchestra.api import router
from orchestra.apps.accounts.api import AccountApiMixin
from . import settings
from .models import WebApp
from .serializers import WebAppSerializer
class WebAppViewSet(AccountApiMixin, viewsets.ModelViewSet):
model = WebApp
serializer_class = WebAppSerializer
filter_fields = ('name',)
def metadata(self, request):
ret = super(WebAppViewSet, self).metadata(request)
names = [
'WEBAPPS_BASE_ROOT', 'WEBAPPS_TYPES', 'WEBAPPS_WEBAPP_OPTIONS',
'WEBAPPS_PHP_DISABLED_FUNCTIONS', 'WEBAPPS_DEFAULT_TYPE'
]
ret['settings'] = {
name.lower(): getattr(settings, name, None) for name in names
}
return ret
router.register(r'webapps', WebAppViewSet)