Commit 3638ec183362dda1756861957e60a1dd11683744

Authored by Zambom
1 parent c35730d0

Adding log to replicate category

Showing 1 changed file with 8 additions and 0 deletions   Show diff stats
categories/views.py
... ... @@ -74,6 +74,7 @@ class CreateCategory(views.SuperuserRequiredMixin, HasRoleMixin, LogMixin, Creat
74 74  
75 75 def get_initial(self):
76 76 initial = super(CreateCategory, self).get_initial()
  77 +
77 78 if self.kwargs.get('slug'):
78 79 category = get_object_or_404(Category, slug = self.kwargs['slug'])
79 80 initial = initial.copy()
... ... @@ -82,6 +83,13 @@ class CreateCategory(views.SuperuserRequiredMixin, HasRoleMixin, LogMixin, Creat
82 83 initial['name'] = category.name
83 84 initial['visible'] = category.visible
84 85 #initial['coordinators'] = category.coordinators
  86 +
  87 + self.log_action = 'replicate'
  88 +
  89 + self.log_context['replicated_category_id'] = category.id
  90 + self.log_context['replicated_category_name'] = category.name
  91 + self.log_context['replicated_category_slug'] = category.slug
  92 +
85 93 return initial
86 94  
87 95  
... ...