# -*- coding: UTF-8 -*-
from django.db import IntegrityError
from django.db.models import Q
from gm_dataquery.dataquery import DataBuilder, DataSQLQuery

from api.models.toprank import TopRankBanner,TopRankMeddle
from gm_dataquery.db import DB

from rpc.exceptions import UniError


class TopRankBannerDB(DataBuilder):
    # def getval_province__name(self, obj):
    #     return obj.province.name if getattr(obj, 'province', None) else ''
    #
    # def getval_has_hospital(self, obj):
    #     return obj.is_hospital_exists()
    pass




@DB
class TopRankBannerDQ(DataSQLQuery):
    model = TopRankBanner
    data_model = TopRankBannerDB
    pass


class TopRankMeddleDB(DataBuilder):
    # def getval_province__name(self, obj):
    #     return obj.province.name if getattr(obj, 'province', None) else ''
    #
    # def getval_has_hospital(self, obj):
    #     return obj.is_hospital_exists()
    pass

@DB
class TopRankMeddleDQ(DataSQLQuery):
    model = TopRankMeddle
    data_model = TopRankMeddleDB
    pass
