<gh_stars>1-10
# -*- coding: utf-8 -*-
from django.http import JsonResponse


class Response(object):
    def __init__(self):
        self.response = {}

    def json(self):
        return JsonResponse(self.response)


class Success(Response):
    def __init__(self, data=None, message='SUCCESS', code="OK"):
        super(Success, self).__init__()

        self.response = {'result': True, 'message': message, 'data': data, 'code': code}


class Fail(Response):
    def __init__(self, message='FAIL', code="FAIL", data=None):
        super(Fail, self).__init__()

        self.response = {'result': False, 'message': message, 'data': data, 'code': code}

# -*- coding: utf-8 -*-
from django.http import JsonResponse


class Response(object):
    def __init__(self):
        self.response = {}

    def json(self):
        return JsonResponse(self.response)


class Success(Response):
    def __init__(self, data=None, message='SUCCESS', code="OK"):
        super(Success, self).__init__()

        self.response = {'result': True, 'message': message, 'data': data, 'code': code}


class Fail(Response):
    def __init__(self, message='FAIL', code="FAIL", data=None):
        super(Fail, self).__init__()

        self.response = {'result': False, 'message': message, 'data': data, 'code': code}
# -*- coding: utf-8 -*-