0

我正在寻找有关 django 中通用视图的一些信息。

我想要一个将为对象呈现表单的页面。在我的页面上,我想要一个提交按钮来更新对象,而另一个提交按钮将删除对象。

是否可以使用单个视图来执行此操作?

4

1 回答 1

1

Yes this is possible. It is possible create a view to handle update and delete functionality using both class based views and function based views. You will find it much easier using function based views. (I'm not sure what you mean by 'merge' DeleteView and UpdateView, but if you're talking about inheritance then no you can't do that).

See this question for starters.

于 2013-02-22T14:41:03.150 回答