如何在django中使用change_form.html模板?

时间:2021-11-03 06:13:06

I have my models and I would like to make use of the Django change_form template to edit my data. Currently I have created my own template that works fine but lacks some of the basic stuff that change_form template might have, like fields validation.

我有我的模型,我想利用Django change_form模板来编辑我的数据。目前我已经创建了自己的模板,该模板工作正常,但缺少change_form模板可能具有的一些基本内容,如字段验证。

Please give examples showing how should I call the template from my view, and what object variables need to be sent to the template.

请举例说明如何从我的视图中调用模板,以及需要将哪些对象变量发送到模板。

Pointers to external projects/links that make use of this templates will be highly appreciated.

指向使用此模板的外部项目/链接的指针将受到高度赞赏。

2 个解决方案

#1


1  

I think what Gath wanted was this: http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html#N1012A

我认为Gath想要的是:http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html#N1012A

I know it's late, but for sure, may be useful for someone else! ;)

我知道现在已经晚了,但肯定会对其他人有用! ;)

#2


0  

The only change_form.html template I know of is in Django's admin application. You don't use the template directly, you'll want to set up the admin application for editing your data. In order to do that, follow the steps in the documentation. If you have problems, post those problems as separate, specific questions.

我所知道的唯一的change_form.html模板是在Django的管理应用程序中。您不直接使用模板,您需要设置管理应用程序来编辑数据。为此,请按照文档中的步骤操作。如果您遇到问题,请将这些问题作为单独的具体问题发布。

#1


1  

I think what Gath wanted was this: http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html#N1012A

我认为Gath想要的是:http://www.ibm.com/developerworks/opensource/library/os-django-admin/index.html#N1012A

I know it's late, but for sure, may be useful for someone else! ;)

我知道现在已经晚了,但肯定会对其他人有用! ;)

#2


0  

The only change_form.html template I know of is in Django's admin application. You don't use the template directly, you'll want to set up the admin application for editing your data. In order to do that, follow the steps in the documentation. If you have problems, post those problems as separate, specific questions.

我所知道的唯一的change_form.html模板是在Django的管理应用程序中。您不直接使用模板,您需要设置管理应用程序来编辑数据。为此,请按照文档中的步骤操作。如果您遇到问题,请将这些问题作为单独的具体问题发布。