def set_default_db(request): if Sido.objects.all().count() == 0: set_sido_info() if KindCd.objects.all().count() == 0: set_kind_info() return ok('Default Value Set')
def abandonment(request): querys = get_querys(request) rslt = get_abandonment(querys) if not isinstance(rslt['rslt'], list): logging.error(pformat(rslt['rslt'])) return error(rslt, msg="Open API Server Error") return ok(rslt)
def shelter_nearby(request): querys = get_querys(request) rslt = get_shelter_nearby(querys) if not isinstance(rslt['rslt'], list): logging.error(pformat(rslt['rslt'])) return error(rslt, msg="Open API Server Error") return ok(rslt)
def sido(request): try: sido = Sido.objects.all() except Sido.DoesNotExist: return error("", msg="Sido data does not exist.") serializer = SidoSerializer(sido, many=True) rslt = make_response_content(response_data=serializer.data, req_param={}, info_data={}) return ok(rslt)
def kind_cd(request): try: kind_cd = KindCd.objects.all() except KindCd.DoesNotExist: return error("", msg="Sido data does not exist.") serializer = KindCdSerializer(kind_cd, many=True) rslt = make_response_content(response_data=serializer.data, req_param={}, info_data={}) return ok(rslt)
def sigungu(request): querys = get_querys(request) try: sigungu = Sigungu.objects.filter(sidoCd=querys['upr_cd']) except Sigungu.DoesNotExist: return error("", msg="Sido data does not exist.") serializer = SigunguSerializer(sigungu, many=True) rslt = make_response_content(response_data=serializer.data, req_param=querys, info_data={}) return ok(rslt)