问题
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