Создан API, добавлен URL
This commit is contained in:
1 parent
cd048faf06
commit
f2f6064db7
5 files changed
+29
-5
No files matched your search
+12
-1
@@ -1,4 +1,15 @@
|
||||
from django.shortcuts import render
|
||||
from rest_framework.views import ListAPIView
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from .serializers import *
|
||||
from .models import *
|
||||
# Create your views here.
|
||||
|
||||
class SafetyFileAPIView(APIView):
|
||||
def get(self, request):
|
||||
|
||||
all_file = SafetyFile.objects.all()
|
||||
serializer_for_file = SafetyFileSerializer(instance=all_file, many=True)
|
||||
# print(serializer_for_file)
|
||||
|
||||
return Response({'Файлы': serializer_for_file})
|
||||
Reference in new issue
Block a user