如何添加分页“转到页面”在 ModelAdmin 表单上将表单设置为 Django admin?

发布于 2024-10-05 14:57:05 字数 304 浏览 0 评论 0原文

这是我想要的场景的要点

我在管理站点中使用了标准的 Django 分页。我想做的是让用户在与某个页码相对应的文本输入中输入一个数字。用户按下 Enter 键或单击按钮。然后显示输入页码的结果。

注意

  • 我使用的是 Django 1.2.3 和 Python 2.65,
  • 我正在修改其他人为我们的管理站点创建的 ModelForm。

非常感谢任何想法、建议和/或评论!

谢谢你,

米肖

Here's the gist of my desired scenario:

I've got the standard Django pagination going in the admin site. What I'd like to do is let a user enter a number into a text input that corresponds to some page number. The user presses enter or clicks a button. Results for the page number entered are then shown.

Note:

  • I'm using Django 1.2.3 with Python 2.65
  • I'm modifying a ModelForm someone else created for our admin site.

Any ideas, suggestions, and/or comments greatly appreciated!

Thank you,

Michaux

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

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

发布评论

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

评论(1

ぽ尐不点ル 2024-10-12 14:57:05

我遇到的每个分页系统(包括标准 Django 分页)都使用 GET 参数来呈现页面。

因此,提供一个表单来获取要显示的页面的页码是使用 html 表单可以做的最简单的事情。

<form>

    <input type="text" name="page">
    <input type="submit">

</form>

要包含此内容,您可能需要覆盖相应的管理模板。

Every pagination system I have come across including the standard Django pagination uses GET parameters for rendering a page.

So, providing a form to get the page number of the page to be displayed is the simplest thing you can do with html forms.

<form>

    <input type="text" name="page">
    <input type="submit">

</form>

To include this, you might want to override the corresponding admin template.

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