# -*- coding: UTF-8 -*-

from gm_dataquery.dataquery import DataBuilder, DataSQLQuery
from gm_dataquery.db import DB

from community.models import Article


class ArticleDB(DataBuilder):
    def getval_topic_info(self, obj):
        return {'id': obj.topic.id, 'title': obj.topic.ask}


@DB
class ArticleDQ(DataSQLQuery):
        model = Article
        data_model = ArticleDB
