我如何重复使用<选项> HTML表格的数据? (django)(干)

发布于 2025-01-31 15:02:43 字数 303 浏览 1 评论 0原文

我正在通过Django生成HTML响应,其中包括大量表单,其中一个字段之一是< select>,其中许多(1,000+)< option> s。

由于重复每种形式的> s,因此HTML响应非常长。我使用分页来减少每个响应中呈现的HTML量,但这对于特定应用程序并不是最佳的。

是否可以在HTML响应中呈现< option> s并在每个表单字段中引用它而不会再次呈现?

I'm generating an HTML response via Django with a large set of forms, and one of the form fields is a <select> with many (1,000+) <option>s in the queryset.

Due to repeating the <option>s for each form, the HTML response is egregiously long. I've used pagination to reduce the amount of HTML rendered in each response, but this isn't optimal for the particular application.

Is it possible to render the <option>s once on the HTML response and reference it in each form field without rendering it again?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文