class WeixinTable(tables.Table): id = tables.Column(orderable=True, visible=False) sync_timestamp2 = DateTimeColumn(verbose_name=u"微信同步时间", orderable=False) status = TemplateColumn(template_name="sync_status_field.html", orderable=False, verbose_name=u"同步状态") games = GameColumn(verbose_name=u"游戏名称", orderable=False, attrs={"class": "games"}) news = NewsColumn(verbose_name=u"游戏情报站", orderable=False, attrs={"class": "news"}) players = PlayerColumn(verbose_name=u"我是玩家", orderable=False, attrs={"class": "players"}) puzzles = PuzzleColumn(verbose_name=u"趣题", orderable=False, attrs={"class": "puzzles"}) ops = TemplateColumn(template_name="weixin_field_ops.html", verbose_name=u"操作", orderable=False, attrs={"class": "ops"}) class Meta: model = Weixin order_by = "-id" empty_text = u"暂无微信消息" fields = ("news", "games", "players", "puzzles", "sync_timestamp2", "status", "ops") sequence = ("news", "games", "players", "puzzles", "sync_timestamp2", "status", "ops") attrs = {'class': 'table table-striped'}
class ExamTable(ObjectTable): name = TemplateColumn(template_name='exam/name_column.html') current_stamp = TemplateColumn(template_name='stamp_column.html', verbose_name='Status', orderable=False) licence = TemplateColumn(template_name='licence_column.html') author = UserColumn() class Meta(ObjectTable.Meta): model = Exam sequence = ('name', 'current_stamp', 'licence', 'author', 'last_modified')
class BookTable(tables.Table): select = TemplateColumn( '<input type="checkbox" value="{{ record.pk }}" />', verbose_name=" ") view = TemplateColumn( template_code= '<a class="btn btn-sm btn-info" href="{% url "book" record.id %}">Fișă</a>', verbose_name=" ") class Meta: model = Book template_name = "django_tables2/bootstrap.html" fields = ("select", "id", "title", "author", "languages", "topics", "description", "view")
class StoreProductQueryAllTable(DashboardTable): isp = TemplateColumn(verbose_name=u'交易商', template_name='dashboard/dataquery/row_list/partner_row_list2.html' ) upc = TemplateColumn(verbose_name=u'商品代码', template_name='dashboard/dataquery/row_list/upc_row_list.html' ) product = TemplateColumn(verbose_name=u'商品名称', template_name='dashboard/dataquery/row_list/title_row_list.html' ) buy = Column(verbose_name=u'买量') sale = Column(verbose_name=u'卖量') can_pickup = Column(verbose_name=u'可提货量') pickup = Column(verbose_name=u'提货量') quantity = Column(verbose_name=u'当前持有量') today_close = TemplateColumn(verbose_name=u'当前冻结量', template_name='dashboard/dataquery/row_list/tdclose_row_list.html') tn_close = TemplateColumn(verbose_name=u'T+N冻结量', template_name='dashboard/dataquery/row_list/tnclose_row_list.html') unit_price = TemplateColumn(verbose_name=u'买入均价', template_name='dashboard/dataquery/row_list/unitp_row_list.html') open_price = TemplateColumn(verbose_name=u'商品市值', template_name='dashboard/dataquery/row_list/price_row_list.html') profit_loss = TemplateColumn(verbose_name=u'盈亏成本', template_name='dashboard/dataquery/row_list/profit_row_list.html') caption = u'存货查询' icon = "sitemap" class Meta(DashboardTable.Meta): sequence = ('isp', 'upc', 'product', 'buy', 'sale', 'can_pickup', 'pickup', 'quantity', 'today_close', 'tn_close', 'unit_price', 'open_price', 'profit_loss', )
class AnnotationTable(tables.Table): modify = TemplateColumn(template_name='annotator/modify_button.html') delete = TemplateColumn(template_name='annotator/delete_button.html') class Meta: model = Annotation # row_attrs = { # 'editing': lambda record: record.editing # } orderable = False fields = ('source', 'belief', 'target', 'strength', 'valuation', 'modify', 'delete') order_by = 'id'
class CommitTable(tables.Table): sha = TemplateColumn( '<a href="https://github.com/python/cpython/commit/{{record.sha}}">{{record.sha}}</a>' ) class Meta: model = Commit fields = ["sha", "creation_date", "message"] attrs = {"class": "responsive-table striped"}
class TradeCompleteQueryTable(DashboardTable): trade_no = Column(verbose_name=u'成交编号', accessor=A('trade_no')) isp = TemplateColumn(verbose_name=u'交易商', template_name='dashboard/dataquery/row_list/partner_row_list.html' ) trader = Column(verbose_name=u'交易员', accessor='product.trader' ) upc = Column(verbose_name=u'商品代码',accessor='product.upc') charge = TemplateColumn(verbose_name=u'卖手续费', template_name='dashboard/dataquery/row_list/trade_row_list.html' ) created_datetime = Column(verbose_name=u'成交时间') caption = u'成交查询' icon = "sitemap" class Meta(DashboardTable.Meta): model = TradeComplete fields = ('product','commission_buy_no','commission_sale_no','c_type','unit_price','quantity','total','created_datetime') sequence = ('trade_no','commission_buy_no','commission_sale_no','isp','trader','upc','product','c_type','unit_price','quantity','total','charge','created_datetime')
class GiftTable(tables.Table): ops = TemplateColumn(template_name="gift_field_ops.html", verbose_name=u"操作", orderable=False, attrs={"class": "ops"}) class Meta: model = Gift attrs = {'class': 'table table-striped'} fields = ('name', 'show', 'integral', 'cost') orderable = False
class EntityTable(tables.Table): id = tables.Column(orderable=False, visible=False) title = tables.Column(verbose_name=u'标题', orderable=False) type = tables.Column(verbose_name=u'类型', orderable=False, accessor='type.verbose_name') presenter = tables.Column(verbose_name=u'推荐人', orderable=False) status = TemplateColumn(template_name="sync_status_field.html", orderable=False, verbose_name=u"同步状态") ops = TemplateColumn(template_name="entity_ops_field.html", verbose_name=u"操作", orderable=False, attrs={"class": "ops"}) class Meta: model = Entity order_by = "-id" empty_text = u"暂无内容" fields = ("title", "type", "presenter", "status", "ops") sequence = ("title", "type", "presenter", "status", "ops") attrs = {'class': 'table table-striped'}
class GameTable(tables.Table): id = tables.Column(orderable=True, visible=False) name = tables.Column(verbose_name=u'名称', orderable=False) presenter = tables.Column(verbose_name=u'推荐人', orderable=False) sync_timestamp1 = DateTimeColumn(verbose_name=u"微博同步时间", orderable=False) sync_timestamp3 = DateTimeColumn(verbose_name=u"网站同步时间", orderable=False) status = TemplateColumn(template_name="sync_status_field.html", orderable=False, verbose_name=u"同步状态") ops = TemplateColumn(template_name="game_field_ops.html", verbose_name=u"操作", orderable=False, attrs={"class": "ops"}) class Meta: model = Game order_by = "-id" empty_text = u"暂无精品游戏推荐" fields = ("name", "presenter", "sync_timestamp1", "sync_timestamp3", "status", "ops") sequence = ("name", "presenter", "sync_timestamp1", "sync_timestamp3", "status", "ops") attrs = {'class': 'table table-striped'}
class EvaluationTable(tables.Table): id = tables.Column(orderable=True, visible=False) title = tables.Column(orderable=False) presenter = tables.Column(orderable=False) sync_timestamp1 = DateTimeColumn(verbose_name=u"微博同步时间", orderable=False) sync_timestamp3 = DateTimeColumn(verbose_name=u"网站同步时间", orderable=False) status = TemplateColumn(template_name="sync_status_field.html", orderable=False, verbose_name=u"同步状态") ops = TemplateColumn(template_name="evaluation_field_ops.html", verbose_name=u"操作", orderable=False, attrs={"class": "ops"}) class Meta: model = Evaluation order_by = "-id" empty_text = u"暂无\"游戏测评\"" fields = ("title", "presenter", "sync_timestamp1", "sync_timestamp3", "status", "ops") sequence = ("title", "presenter", "sync_timestamp1", "sync_timestamp3", "status", "ops") attrs = {'class': 'table table-striped'}
class GiftItemTable(tables.Table): value = ValueColumn(attrs={"class": "value"}) grade = tables.Column(verbose_name=u"礼品类型", accessor='grade.name') ops = TemplateColumn(template_name="gift_item_field_ops.html", verbose_name=u"操作", orderable=False, attrs={"class": "ops"}) class Meta: model = GiftItem order_by = '-state' attrs = {'class': 'table table-striped'} orderable = False exclude = ('id')
class DialogTable(tables.Table): id = tables.Column(orderable=False, visible=False) question = tables.Column(orderable=False) answer = tables.Column(orderable=False) presenter = tables.Column(orderable=False) ops = TemplateColumn(template_name="dialog_field_ops.html", verbose_name=u"操作", orderable=False, attrs={"class": "ops"}) class Meta: model = BaseDialog empty_text = u"暂无\"基本对话\"" fields = ("id", "question", "answer", "presenter", "ops") sequence = ("id", "question", "answer", "presenter", "ops") attrs = {'class': 'table table-striped'}
class CommissionQueryTable(DashboardTable): commission_no = Column(verbose_name=u'委托编号', accessor=A('commission_no') ) isp = TemplateColumn(verbose_name=u'交易商', template_name='dashboard/dataquery/row_list/partner_row_list.html' ) trader = Column(verbose_name=u'交易员', accessor='product.trader' ) upc = Column(verbose_name=u'商品代码',accessor='product.upc') product = Column(verbose_name=u'商品') c_type = Column(verbose_name=u'交易类型') quantity = Column(verbose_name=u'数量') uncomplete_quantity = Column(verbose_name=u'未成交数量') status = Column(verbose_name=u'状态') created_datetime = Column(verbose_name=u'委托时间') unit_price = Column(verbose_name=u'委托价格') caption = u'委托查询' icon = "sitemap" class Meta(DashboardTable.Meta): #fields = ('product','c_type','unit_price','quantity','uncomplete_quantity','status','created_datetime') sequence = ('commission_no','isp','trader','upc', 'product','c_type','unit_price','quantity','uncomplete_quantity','status','created_datetime')