Esempio n. 1
0
# Django modules
from rest_framework import viewsets
from django.http import JsonResponse
from rest_framework.decorators import action
from rest_framework import status

from common.logger import CustomLogger

from products.serializers import ProductSerializer
from products.bll.product_bll import ProductManager
from products.bll.product_integrators import ProductIntegrator

import pandas as pd

logger = CustomLogger.get_logger(__name__)
logger.info("initiating api-views")

class Constant:
    IS_ERROR = True
    FAILED_STATUS = "FAILED"
    DEFAULT_MSG = "Something Went Wrong"
    POST = "POST"
    GET = "GET"

class ProductView(viewsets.ViewSet):
    def __init__(self, **kwargs):
        super(ProductView, self).__init__(**kwargs)

    @action(
        detail=True,
Esempio n. 2
0
# Django module and packages
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import action
from rest_framework import viewsets

# Project module and packages
from common.restapiviewwrapper import (
    Response, status, AllowAnyAPIView
)
from common.response import \
    ResponseEntity, ExceptionResponseEntity, ValidationErrorResponseEntity
from common.common_methods import convert_to_dict
from location.bll.location_bll import LocationManager
from common.logger import CustomLogger
LOGGER = CustomLogger.get_logger(__name__)

class Constant:
    """ defining constant"""
    IS_ERROR = True
    FAILED_STATUS = "FAILED"
    DEFUALT_MSG = "Something Went Wrong"
    POST = "POST"
    GET = "GET"


class LocationView(viewsets.ViewSet, AllowAnyAPIView):
    """ Location related operation """
    def __init__(self, **kwargs):
        super(LocationView, self).__init__(**kwargs)
        self.success_resp = ResponseEntity()