From 3638ec183362dda1756861957e60a1dd11683744 Mon Sep 17 00:00:00 2001 From: Zambom Date: Fri, 30 Dec 2016 15:05:28 -0200 Subject: [PATCH] Adding log to replicate category --- categories/views.py | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/categories/views.py b/categories/views.py index 6290255..c04c966 100644 --- a/categories/views.py +++ b/categories/views.py @@ -74,6 +74,7 @@ class CreateCategory(views.SuperuserRequiredMixin, HasRoleMixin, LogMixin, Creat def get_initial(self): initial = super(CreateCategory, self).get_initial() + if self.kwargs.get('slug'): category = get_object_or_404(Category, slug = self.kwargs['slug']) initial = initial.copy() @@ -82,6 +83,13 @@ class CreateCategory(views.SuperuserRequiredMixin, HasRoleMixin, LogMixin, Creat initial['name'] = category.name initial['visible'] = category.visible #initial['coordinators'] = category.coordinators + + self.log_action = 'replicate' + + self.log_context['replicated_category_id'] = category.id + self.log_context['replicated_category_name'] = category.name + self.log_context['replicated_category_slug'] = category.slug + return initial -- libgit2 0.21.2