def post(self, request, *args, **kwargs): self.app = self.get_object() if self.app.run_plan: return application_error(request, self.app, _("Application is already started")) elif not self.app.can_start: return application_error(request, self.app, _("Application cannot be started yet")) return super(StartApplicationView, self).post(request, *args, **kwargs)
def post(self, request, *args, **kwargs): self.app = self.get_object() if not self.app.run_plan: return application_error(request, self.app, _("Application is stopped")) return super(EditApplicationRunPlanView, self).post(request, *args, **kwargs)
def form_valid(self, form): self.get_context_data() if self.object.id != self.object.application.current_package.id: self.object.delete() return HttpResponseRedirect(self.get_success_url()) else: return application_error(self.request, self.object.application, _("Package in use"))
def validate_action(self, request): if self.object == self.object.application.current_package: return application_error( request, self.object, _("Selected package is already current " "for this application"))
def validate_action(self, request): if not self.object.run_plan: return application_error(request, self.object, _("Application is already stopped"))