Skip to content

Commit

Permalink
Redirect to course structure edit when added/duplicated a course
Browse files Browse the repository at this point in the history
Users can now directly edit the course structure after they added or duplicated a course. Previously, they were just redirected to dashboard.
This implements #10 but without step indicator to better indicate that the course was already created when the structure edit page is reached.
  • Loading branch information
bhaettasch committed Jul 20, 2021
1 parent 8ed1aea commit 00acca0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class DuplicateCourseView(SuccessMessageMixin, LoginRequiredMixin, CreateView):
model = Course
template_name = 'frontend/course/duplicate.html'
form_class = AddCourseForm
success_url = reverse_lazy('frontend:dashboard')

def get_success_url(self):
return reverse_lazy('frontend:course-edit-structure', kwargs={'pk': self.object.pk})

def get_success_message(self, cleaned_data):
"""Success message
Expand Down Expand Up @@ -120,7 +122,9 @@ class AddCourseView(SuccessMessageMixin, LoginRequiredMixin, CreateView):
model = Course
template_name = 'frontend/course/create.html'
form_class = AddCourseForm
success_url = reverse_lazy('frontend:dashboard')

def get_success_url(self):
return reverse_lazy('frontend:course-edit-structure', kwargs={'pk': self.object.pk})

def get_success_message(self, cleaned_data):
"""Success message
Expand Down

0 comments on commit 00acca0

Please sign in to comment.