blob: 9e2849de0fa360e096610b2802b06e74dc9a83b6 [file] [log] [blame]
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework import status
from core.models import *
from django.forms import widgets
from services.progran.models import *
from xos.apibase import XOSListCreateAPIView, XOSRetrieveUpdateDestroyAPIView, XOSPermissionDenied
from api.xosapi_helpers import PlusModelSerializer, XOSViewSet, ReadOnlyField
import json
BASE_NAME = 'progran'
class VProgranProfileSerializer(PlusModelSerializer):
id = ReadOnlyField()
uiid = serializers.CharField(required=False)
profile = serializers.CharField(required=False)
dlrate = serializers.CharField(required=False)
ulrate = serializers.CharField(required=False)
class Meta:
model = VProgranProfile
fields = ('uiid','id', 'profile', 'dlrate' , 'ulrate')
class VProgranImsiSerializer(PlusModelSerializer):
id = ReadOnlyField()
uiid = serializers.CharField(required=False)
imsi = serializers.CharField(required=False)
profile = serializers.CharField(required=False)
class Meta:
model = VProgranImsi
fields = ('uiid','id', 'imsi', "profile")
class ProgranProfileViewSet(XOSViewSet):
base_name = "progran"
method_name = "profile"
method_kind = "viewset"
queryset = VProgranProfile.objects.all()
serializer_class = VProgranProfileSerializer
@classmethod
def get_urlpatterns(self, api_path="^"):
patterns = super(ProgranProfileViewSet, self).get_urlpatterns(api_path=api_path)
return patterns
def list(self, request):
object_list = self.filter_queryset(self.get_queryset())
serializer = self.get_serializer(object_list, many=True)
return Response(serializer.data)
class ProgranImsiViewSet(XOSViewSet):
base_name = "progran"
method_name = "imsi"
method_kind = "viewset"
queryset = VProgranImsi.objects.all()
serializer_class = VProgranImsiSerializer
@classmethod
def get_urlpatterns(self, api_path="^"):
patterns = super(ProgranImsiViewSet, self).get_urlpatterns(api_path=api_path)
return patterns
def list(self, request):
object_list = self.filter_queryset(self.get_queryset())
serializer = self.get_serializer(object_list, many=True)
return Response(serializer.data)