2021-08-24 06:20:54 +00:00
|
|
|
from rest_framework.generics import ListAPIView
|
|
|
|
from rest_framework.response import Response
|
|
|
|
|
|
|
|
from common.permissions import IsSuperUser
|
2021-10-21 09:08:17 +00:00
|
|
|
from common.sdk.sms import BACKENDS
|
2021-08-24 06:20:54 +00:00
|
|
|
from settings.serializers.sms import SMSBackendSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class SMSBackendAPI(ListAPIView):
|
|
|
|
permission_classes = (IsSuperUser,)
|
|
|
|
serializer_class = SMSBackendSerializer
|
|
|
|
|
|
|
|
def list(self, request, *args, **kwargs):
|
|
|
|
data = [
|
|
|
|
{
|
|
|
|
'name': b,
|
|
|
|
'label': b.label
|
|
|
|
}
|
|
|
|
for b in BACKENDS
|
|
|
|
]
|
|
|
|
|
|
|
|
return Response(data)
|