如何在Django管理员变更列表页面中创建新表单 [英] How can i create new form in django admin changelist page

查看:40
本文介绍了如何在Django管理员变更列表页面中创建新表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的django更改列表页面已被覆盖.

I have the django changelist page overridden.

我已经将模板 change_list_results 更改为我想要的样子.

I have changed the template change_list_results to lokk like i want.

但是我想在标题中使用小格式,例如 export pdf ,但是当我在HTML中添加 form 标记时,Django会自动剥离它,因为结果已经在form标记内

However i want to have small form in header like export pdf but when i add form tag to the html then Django automatically strips it because results are already inside form tag.

如何解决?

推荐答案

结果位于更改列表形式"表单内,根据规则,您不能在另一个表单内添加表单.您可以做的是将表格添加到变更列表表格"之外.

Results are inside the 'changelist-form' form, and by rule, you cannot add a form inside another. What you can do is to add the form outside of the 'changelist-form'.

https://github.com/django/django/blob/stable/1.4.x/django/contrib/admin/templates/admin/change_list.html#L86

这篇关于如何在Django管理员变更列表页面中创建新表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆