#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__: vv
# Date: 2019/9/2

from gm_dataquery.db import DB
from api.models import MarketTag, User
from gm_dataquery.dataquery import DataBuilder, DataSQLQuery


class MarketTagDB(DataBuilder):
    def getval_operate_uesr(self, obj):
        if obj.operater:
            return User.objects.get(id=obj.operater).username
        else:
            return ''



@DB
class MarketTagDQ(DataSQLQuery):
    model = MarketTag
    data_model = MarketTagDB
