在一个视图中设置表标题时,我有三个表视图都为django-table2

问题描述

在views.py中定义了视图表视图

    class CompletedClassList(SingleTableMixin,FilterView):
        table_class = ClassTable
        table_class.title='Completed Classes'
        filterset_class = ClassFilter
    
        template_name = "classes/class_list.html"
        table_pagination = {"per_page": 20}
    
            def get_queryset(self):
                today = datetime.date.today()
                completed_classes = Class.objects.filter(class_start_date__lte=today)
                return completed_classes

然后在模板中,我这样称呼表标题:

    <div class="row col=md-12 may-form-space">
       <div class="col-md-3 text-md-left">
           <label class="may-form-section">{{ table.title }}</label>
       </div>
    </div>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)