initiate drf app
This commit is contained in:
19
backend/api/main/views.py
Normal file
19
backend/api/main/views.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from rest_framework import status
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from api.utils.decorators import handle_exceptions
|
||||
|
||||
from api.main.serializers import FAQMainSerializer
|
||||
from mainpage.models import FAQ
|
||||
|
||||
class FAQView(APIView):
|
||||
@handle_exceptions
|
||||
def get(self, request):
|
||||
|
||||
faqs = FAQ.objects.all()
|
||||
|
||||
data = {
|
||||
'faqs': FAQMainSerializer(faqs, many=True).data
|
||||
}
|
||||
|
||||
return Response(data, status=status.HTTP_200_OK)
|
||||
Reference in New Issue
Block a user