API дополнена query params
This commit is contained in:
1 parent
5c7e3d5e2e
commit
5b8c627033
2 files changed
+3
-2
No files matched your search
+2
-1
@@ -10,7 +10,8 @@ from .models import *
|
||||
class SafetyFileAPIView(APIView):
|
||||
def get(self, request):
|
||||
|
||||
all_file = SafetyFile.objects.order_by('chapter_id', 'category_id').all()
|
||||
chapters = self.request.query_params.get('chapter_id', 1)
|
||||
all_file = SafetyFile.objects.filter(chapter_id=chapters).order_by('chapter_id', 'category_id').all()
|
||||
serializer_for_file = SafetyFileSerializer(instance=all_file, many=True)
|
||||
|
||||
data = []
|
||||
|
||||
Reference in new issue
Block a user