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 286 initial = super(SubjectCreateView, self).get_initial()
287 287  
288 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 290 # print (initial)
291 291 # initial['professor'] = User.objects.all()
292 292  
293 293 if self.kwargs.get('subject_slug'): #when the user replicate a subject
294 294 subject = get_object_or_404(Subject, slug = self.kwargs['subject_slug'])
295 295 initial = initial.copy()
296   - initial['category'] = subject.category
  296 + initial['category'] = Category.objects.filter(slug = subject.category.slug)
297 297 initial['description'] = subject.description
298 298 initial['name'] = subject.name
299 299 initial['visible'] = subject.visible
... ...