热衷于重用 Django admin 的表头排序功能?

发布于 2024-09-13 11:03:18 字数 36 浏览 3 评论 0原文

是否可以在我自己的视图和模板中重用管理表单的表头排序功能?

Is possible to reuse the table header sort feature of the admin forms in my own views and templates?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

橘亓 2024-09-20 11:03:18

好吧,不重复使用管理功能,但您可以使用 http://github.com/directeur /django-sorting 具有相同的效果。在您自己的项目中实现起来非常容易。

http://code.google.com/p/django-pagination/< 一起使用/a> 但两者都可以独立使用。

Well, not re-use of the admin's feature, but you can use http://github.com/directeur/django-sorting for the same effect. It's ridiculously easy to implement in your own projects.

Use it together with http://code.google.com/p/django-pagination/ though either can be used independently of each other.

束缚m 2024-09-20 11:03:18

为什么要重用 django-admin 的排序。在 queryset 的情况下排序非常容易。我只是使用了 get 请求并传递 col 值和排序顺序,如 o=1&ord=asc 。在我看来,我制作了一个字典,它为我提供了列值。查询集输出有一个 order_by 方法。

Why to reuse the sorting of django-admin.Sorting is very easy in case of queryset.I simply used a get request and pass the col value and order of ording like o=1&ord=asc.In my view i made a dictionary which gives me the column value .THe queryset output has a order_by method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文