This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2019-10-28 16:40:57 +00:00
|
|
|
"""OAuth Source Serializer"""
|
|
|
|
from rest_framework.serializers import ModelSerializer
|
|
|
|
from rest_framework.viewsets import ModelViewSet
|
|
|
|
|
|
|
|
from passbook.admin.forms.source import SOURCE_SERIALIZER_FIELDS
|
|
|
|
from passbook.sources.oauth.models import OAuthSource
|
|
|
|
|
|
|
|
|
|
|
|
class OAuthSourceSerializer(ModelSerializer):
|
|
|
|
"""OAuth Source Serializer"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = OAuthSource
|
2019-12-31 11:51:16 +00:00
|
|
|
fields = SOURCE_SERIALIZER_FIELDS + [
|
|
|
|
"provider_type",
|
|
|
|
"request_token_url",
|
|
|
|
"authorization_url",
|
|
|
|
"access_token_url",
|
|
|
|
"profile_url",
|
|
|
|
"consumer_key",
|
|
|
|
"consumer_secret",
|
|
|
|
]
|
2019-10-28 16:40:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
class OAuthSourceViewSet(ModelViewSet):
|
|
|
|
"""Source Viewset"""
|
|
|
|
|
|
|
|
queryset = OAuthSource.objects.all()
|
|
|
|
serializer_class = OAuthSourceSerializer
|