Browse Source

modified: apiviews/__init__.py
new file: apiviews/personinfo.py
modified: models/__init__.py
new file: models/personinfo.py
modified: serializer/__init__.py
new file: serializer/personinfo.py
modified: urls.py

stuckedS 1 year ago
parent
commit
1b09328690
7 changed files with 36 additions and 4 deletions
  1. 2 1
      apiviews/__init__.py
  2. 10 0
      apiviews/personinfo.py
  3. 2 1
      models/__init__.py
  4. 12 0
      models/personinfo.py
  5. 2 1
      serializer/__init__.py
  6. 7 0
      serializer/personinfo.py
  7. 1 1
      urls.py

+ 2 - 1
apiviews/__init__.py

@@ -7,4 +7,5 @@ from .provider import ProviderMVS
 from .relationship import RelationshipMVS
 from .resource import ResourceMVS
 from .service import ServiceMVS
-from .servicetype import ServiceTypeMVS
+from .servicetype import ServiceTypeMVS
+from .personinfo import PersonInfoMVS

+ 10 - 0
apiviews/personinfo.py

@@ -0,0 +1,10 @@
+from metaservicesynced.serializer import PersonInfoSerializer
+from rest_framework import viewsets, permissions
+from metaservicesynced.models import PersonInfo
+
+class PersonInfoMVS(viewsets.ModelViewSet):
+
+    queryset = PersonInfo.objects.all()
+    serializer_class = PersonInfoSerializer
+    #permission_classes = [IsOwnerOrReadOnly]
+    permission_classes = [permissions.IsAuthenticated]

+ 2 - 1
models/__init__.py

@@ -7,4 +7,5 @@ from .provider import Provider
 from .relationship import Relationship
 from .resource import Resource
 from .service import Service
-from .servicetype import ServiceType
+from .servicetype import ServiceType
+from .personinfo import PersonInfo

+ 12 - 0
models/personinfo.py

@@ -0,0 +1,12 @@
+from django.db import models
+from SharixAdmin.models import SharixUser
+from tickets.models import Task
+
+class PersonInfo(models.Model):
+    last_name = models.CharField(max_length=150, help_text="Фамилия пользователя")
+    first_name = models.CharField(max_length=150, help_text="Имя пользователя")
+
+    class Meta:
+        db_table = "auth_user"
+        verbose_name = "Пользователя"
+        verbose_name_plural = "Пользователи"

+ 2 - 1
serializer/__init__.py

@@ -7,4 +7,5 @@ from .provider import ProviderSerializer
 from .relationship import RelationshipSerializer
 from .resource import ResourceSerializer
 from .service import ServiceSerializer
-from .servicetype import ServiceTypeSerializer
+from .servicetype import ServiceTypeSerializer
+from .personinfo import PersonInfoSerializer

+ 7 - 0
serializer/personinfo.py

@@ -0,0 +1,7 @@
+from rest_framework import serializers
+from metaservicesynced.models import PersonInfo
+
+class PersonInfoSerializer(serializers.ModelSerializer):
+    class Meta:
+        model = PersonInfo
+        exclude = ["id"]

+ 1 - 1
urls.py

@@ -13,7 +13,7 @@ router.register(r'relationship', RelationshipMVS)
 router.register(r'resource', ResourceMVS)
 router.register(r'service', ServiceMVS)
 router.register(r'servicetype', ServiceTypeMVS)
-
+router.register(r'personinfo', PersonInfoMVS)
 urlpatterns = [  
     path('api/', include(router.urls), name="metasynced"),
 ]