Commit f343ade6dd9f2907d34a74d294f9fb6d464137f4

Authored by Zambom
1 parent 22dc44c6

Adjusting bug in replicate subject

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
subjects/views.py
@@ -286,14 +286,14 @@ class SubjectCreateView(LoginRequiredMixin, LogMixin, CreateView): @@ -286,14 +286,14 @@ class SubjectCreateView(LoginRequiredMixin, LogMixin, CreateView):
286 initial = super(SubjectCreateView, self).get_initial() 286 initial = super(SubjectCreateView, self).get_initial()
287 287
288 if self.kwargs.get('slug'): #when the user creates a subject 288 if self.kwargs.get('slug'): #when the user creates a subject
289 - initial['category'] = Category.objects.all().filter(slug=self.kwargs['slug']) 289 + initial['category'] = Category.objects.filter(slug=self.kwargs['slug'])
290 # print (initial) 290 # print (initial)
291 # initial['professor'] = User.objects.all() 291 # initial['professor'] = User.objects.all()
292 292
293 if self.kwargs.get('subject_slug'): #when the user replicate a subject 293 if self.kwargs.get('subject_slug'): #when the user replicate a subject
294 subject = get_object_or_404(Subject, slug = self.kwargs['subject_slug']) 294 subject = get_object_or_404(Subject, slug = self.kwargs['subject_slug'])
295 initial = initial.copy() 295 initial = initial.copy()
296 - initial['category'] = subject.category 296 + initial['category'] = Category.objects.filter(slug = subject.category.slug)
297 initial['description'] = subject.description 297 initial['description'] = subject.description
298 initial['name'] = subject.name 298 initial['name'] = subject.name
299 initial['visible'] = subject.visible 299 initial['visible'] = subject.visible