def delete(self, request, *args, **kwargs): self.old = self.get_object() try: kickstart.client_delete(self.old) log_form_valid(self) messages.success(self.request, 'Client {0} removed!'.format(self.old.name)) return super(Delete, self).delete(request, *args, **kwargs) except Exception as msg: featherfail(self, msg) return super(Delete, self).get(request, *args, **kwargs)
def form_valid(self, form): try: old = Client.objects.get(id=self.object.id) kickstart.client_delete(old) form = kickstart.client_create(form, old) log_form_valid(self) messages.success(self.request, 'Changes saved!') return super(Update, self).form_valid(form) except Exception as msg: featherfail(self, msg) return super(Update, self).form_invalid(form)