我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用django.views.generic.edit.UpdateView()。
def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) context['edit_header'] = "Edit Client" return context # Abuse Update view
def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) context['edit_header'] = "Edit Abuse" return context # Situation Update view
def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) context['edit_header'] = "Edit Current Situation" return context # Service Update view
def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) context['edit_header'] = "Edit Requested Services" return context # Abuse Update view
def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) context['edit_header'] = "Edit Referral" return context # User profile page
def get_edit_view_class(self): class UUpdateView(UpdateView): def form_valid(self, form): self.object = form.save(commit=False) self.object.user = self.request.user self.object.save() return HttpResponseRedirect(self.get_success_url()) return UUpdateView
def post(self, request, *args, **kwargs): if 'save_timelog_change' in request.POST: return super(UpdateView, self).post(self, request, args, kwargs) # direct to delete-template return HttpResponseRedirect(reverse('issue:logdelete', kwargs={'project': self.kwargs['project'], 'sqn_i': self.kwargs['sqn_i'], 'sqn_l': self.kwargs['sqn_l']}))