Can I make a view using UpdateView and DeleteView together?

梦想的初衷 提交于 2019-12-10 11:55:49

问题


I am looking for some information about generic views in django.

I want a page that will render a form for an object. On my page I want one submit button to update the object and another submit button that will delete the object.

Is it a possible to do this using a single view?


回答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.



来源:https://stackoverflow.com/questions/15025300/can-i-make-a-view-using-updateview-and-deleteview-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!