/
home
/
report
/
liman_adapter
/
Prices
/
File Upload :
llllll
Current File: /home/report/liman_adapter/Prices/api.py
import json from rest_framework import viewsets from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import status from django.http import JsonResponse from Core.table_engine.src.table_engine import TableEngine from .models import Price from .serializer import PriceSerializer class PricesApi(viewsets.ModelViewSet): queryset = Price.objects.all() serializer_class = PriceSerializer http_method_names = ['get', 'post', 'patch', 'put', 'delete'] @staticmethod @api_view(['POST']) def table(request): try: table_engine = TableEngine(Price.objects, request.dict).init_cols( ["ID", "NO", "Price", 'Tarikh']).execute() return JsonResponse(table_engine) except Exception as e: return Response(str(e), 422)
Copyright ©2k19 -
Hexid
|
Tex7ure