一个简单的django应用程序,它将搜索和排序添加到html表中。
django-searchly-tables的Python项目详细描述
#django searchly tables
一个简单的django应用程序,它将搜索和排序添加到html表中。
我喜欢使用简单视图,但它也应该使用基于类的视图(但我还没有测试过)。
“搜索表”,
)
并指定要为哪个模型使用它:
from django.shortcuts import render
from example.model import example model
from searchly\u tables.tables import searchly table
def view(request):
table=searchlytable(module=“exampleapp.models”,model=“examplemodel”,字段筛选=字段筛选)
table.labels={basefield1':'labelforbasefield1','foreignkey\u relationship':'labelforforeignkeyrationship',“basefield2”:“labelforbasefield2”}
像这样:
<;form action=“”method=post>;
{%csrf_token%}
{table.searchbar safe}
<;table>;
{{table.header safe}{table.body safe}
<;/table>;
<;/form>;
!很自然,您可以通过应用css来更改表的外观。
例如“table.attrs['td']=“my戋td戋class”将导致“<;td class="my_td_class">` on all td elements in the table.
django searchly表当前仅支持类;抱歉,到目前为止还没有直接的样式。
对于大多数元素,也没有通过id直接访问单个元素;唯一的例外是“<;td>;`.
_
也许?可能没有?
这是一个超级基本的应用程序,几乎没有模糊。代码仍然到处都是。
如果这是给你的,酷。如果你需要更多的选项在你的标签(?),
您应该查看[django_tables2](https://django-tables2.readthedocs.io)。
你没听说过Django\u Tables2吗?它好多了,有很多功能!_是的,我同意。我甚至在之前的回答中提到过!
我真的需要这个。可能不是吗?我对它现在的工作方式很满意,除了一些小问题(=代码清理/文档)。
但是如果您需要功能x,欢迎使用fork。或者使用django_table2(说真的,它很棒!).
一个简单的django应用程序,它将搜索和排序添加到html表中。
我喜欢使用简单视图,但它也应该使用基于类的视图(但我还没有测试过)。
“搜索表”,
)
并指定要为哪个模型使用它:
from django.shortcuts import render
from example.model import example model
from searchly\u tables.tables import searchly table
def view(request):
table=searchlytable(module=“exampleapp.models”,model=“examplemodel”,字段筛选=字段筛选)
table.labels={basefield1':'labelforbasefield1','foreignkey\u relationship':'labelforforeignkeyrationship',“basefield2”:“labelforbasefield2”}
像这样:
<;form action=“”method=post>;
{%csrf_token%}
{table.searchbar safe}
<;table>;
{{table.header safe}{table.body safe}
<;/table>;
<;/form>;
!很自然,您可以通过应用css来更改表的外观。
例如“table.attrs['td']=“my戋td戋class”将导致“<;td class="my_td_class">` on all td elements in the table.
django searchly表当前仅支持类;抱歉,到目前为止还没有直接的样式。
对于大多数元素,也没有通过id直接访问单个元素;唯一的例外是“<;td>;`.
_
也许?可能没有?
这是一个超级基本的应用程序,几乎没有模糊。代码仍然到处都是。
如果这是给你的,酷。如果你需要更多的选项在你的标签(?),
您应该查看[django_tables2](https://django-tables2.readthedocs.io)。
你没听说过Django\u Tables2吗?它好多了,有很多功能!_是的,我同意。我甚至在之前的回答中提到过!
我真的需要这个。可能不是吗?我对它现在的工作方式很满意,除了一些小问题(=代码清理/文档)。
但是如果您需要功能x,欢迎使用fork。或者使用django_table2(说真的,它很棒!).