Evgeny Polivanov 1 năm trước cách đây
mục cha
commit
cfa6d16a41
3 tập tin đã thay đổi với 35 bổ sung0 xóa
  1. 17 0
      apiview.py
  2. 8 0
      serializer.py
  3. 10 0
      urls.py

+ 17 - 0
apiview.py

@@ -0,0 +1,17 @@
+from .serializer import *
+from rest_framework import viewsets, permissions, exceptions
+from rest_framework.authentication import TokenAuthentication
+from rest_framework.decorators import action
+from metaservicesynced.models import *
+from rest_framework.views import APIView
+from rest_framework.response import Response
+
+class DocumentsMVS(viewsets.ModelViewSet):
+    """
+    
+    """
+
+    queryset = Documents.objects.all()
+    serializer_class = DocumentsSerializer
+    #permission_classes = [IsOwnerOrReadOnly]
+    permission_classes = [permissions.IsAuthenticated]

+ 8 - 0
serializer.py

@@ -0,0 +1,8 @@
+from rest_framework import serializers
+from .models import *
+from django.contrib.auth.models import *
+
+class DocumentsSerializer(serializers.ModelSerializer):
+    class Meta:
+        model = Documents
+        exclude = ["id"]

+ 10 - 0
urls.py

@@ -0,0 +1,10 @@
+from metaservicesynced.apiview import *
+from rest_framework import routers
+from django.urls import path, include
+
+router = routers.SimpleRouter()
+router.register(r'documents', DocumentsMVS)
+
+urlpatterns = [  
+    path('api/', include(router.urls), name="documents"),
+]