def get_success_url(self):
if not self.object.subject.visible:
self.object.visible = False
self.object.save()
if not self.object.visible and not self.object.repository:
Resource.objects.filter(topic = self.object).update(visible = False)
messages.success(self.request, _('Topic "%s" was updated on virtual enviroment "%s" successfully!')%(self.object.name, self.object.subject.name))
self.log_context['category_id'] = self.object.subject.category.id
self.log_context['category_name'] = self.object.subject.category.name
self.log_context['category_slug'] = self.object.subject.category.slug
self.log_context['subject_id'] = self.object.subject.id
self.log_context['subject_name'] = self.object.subject.name
self.log_context['subject_slug'] = self.object.subject.slug
self.log_context['topic_id'] = self.object.id
self.log_context['topic_name'] = self.object.name
self.log_context['topic_slug'] = self.object.slug
super(UpdateView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context)
return reverse_lazy('subjects:view', kwargs = {'slug': self.object.subject.slug})
评论列表
文章目录