summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/test_views.py12
-rw-r--r--yaksh/views.py28
2 files changed, 20 insertions, 20 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 8c79085..ef9863c 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -3886,7 +3886,7 @@ class TestCourseStudents(TestCase):
username=self.user1.username,
password=self.user1_plaintext_pass
)
- url = reverse('yaksh:course_students', kwargs={
+ url = reverse('yaksh:course_detail', kwargs={
'course_id': self.user1_course.id
})
response = self.client.get(url)
@@ -3898,7 +3898,7 @@ class TestCourseStudents(TestCase):
username=self.user1.username,
password=self.user1_plaintext_pass
)
- url = reverse('yaksh:course_students', kwargs={
+ url = reverse('yaksh:course_detail', kwargs={
'course_id': self.user1_course.id
})
response = self.client.get(url)
@@ -3910,7 +3910,7 @@ class TestCourseStudents(TestCase):
username=self.user1.username,
password=self.user1_plaintext_pass
)
- url = reverse('yaksh:course_students', kwargs={
+ url = reverse('yaksh:course_detail', kwargs={
'course_id': self.user1_course.id
})
response = self.client.get(url)
@@ -3922,7 +3922,7 @@ class TestCourseStudents(TestCase):
username=self.user1.username,
password=self.user1_plaintext_pass
)
- url = reverse('yaksh:course_students', kwargs={
+ url = reverse('yaksh:course_detail', kwargs={
'course_id': self.user1_course.id
})
response = self.client.get(url)
@@ -3936,7 +3936,7 @@ class TestCourseStudents(TestCase):
username=self.user2.username,
password=self.user2_plaintext_pass
)
- url = reverse('yaksh:course_students', kwargs={
+ url = reverse('yaksh:course_detail', kwargs={
'course_id': self.user1_course.id,
})
response = self.client.get(url)
@@ -3947,7 +3947,7 @@ class TestCourseStudents(TestCase):
username=self.student1,
password=self.student1_plaintext_pass
)
- url = reverse('yaksh:course_students', kwargs={
+ url = reverse('yaksh:course_detail', kwargs={
'course_id': self.user1_course.id,
})
response = self.client.get(url)
diff --git a/yaksh/views.py b/yaksh/views.py
index 4a97d1a..5761f37 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -1218,7 +1218,7 @@ def enroll_user(request, course_id, user_id=None, was_rejected=False):
'instructor/administrator.'
)
messages.warning(request, msg)
- return redirect('yaksh:course_students', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
if not course.is_creator(user) and not course.is_teacher(user):
raise Http404('This course does not belong to you')
@@ -1226,7 +1226,7 @@ def enroll_user(request, course_id, user_id=None, was_rejected=False):
user = User.objects.get(id=user_id)
course.enroll(was_rejected, user)
messages.success(request, 'Enrolled student successfully')
- return redirect('yaksh:course_students', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
@login_required
@@ -1241,7 +1241,7 @@ def reject_user(request, course_id, user_id=None, was_enrolled=False):
user = User.objects.get(id=user_id)
course.reject(was_enrolled, user)
messages.success(request, "Rejected students successfully")
- return redirect('yaksh:course_students', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
@login_required
@@ -1260,7 +1260,7 @@ def enroll_reject_user(request,
'instructor/administrator.'
)
messages.warning(request, msg)
- return redirect('yaksh:course_students', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
if not course.is_creator(user) and not course.is_teacher(user):
raise Http404('This course does not belong to you')
@@ -1270,21 +1270,21 @@ def enroll_reject_user(request,
enroll_ids = request.POST.getlist('check')
if not enroll_ids:
messages.warning(request, "Please select atleast one student")
- return redirect('yaksh:course_students', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
users = User.objects.filter(id__in=enroll_ids)
course.enroll(was_rejected, *users)
messages.success(request, "Enrolled student(s) successfully")
- return redirect('yaksh:course_students', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
if 'reject' in request.POST:
reject_ids = request.POST.getlist('check')
if not reject_ids:
messages.warning(request, "Please select atleast one student")
- return redirect('yaksh:course_students', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
users = User.objects.filter(id__in=reject_ids)
course.reject(was_enrolled, *users)
messages.success(request, "Rejected students successfully")
- return redirect('yaksh:course_students', course_id=course_id)
- return redirect('yaksh:course_students', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
+ return redirect('yaksh:course_detail', course_id=course_id)
@login_required
@@ -2441,13 +2441,13 @@ def upload_users(request, course_id):
if request.method == 'POST':
if 'csv_file' not in request.FILES:
messages.warning(request, "Please upload a CSV file.")
- return my_redirect(reverse('yaksh:course_students',
+ return my_redirect(reverse('yaksh:course_detail',
args=[course_id]))
csv_file = request.FILES['csv_file']
is_csv_file, dialect = is_csv(csv_file)
if not is_csv_file:
messages.warning(request, "The file uploaded is not a CSV file.")
- return my_redirect(reverse('yaksh:course_students',
+ return my_redirect(reverse('yaksh:course_detail',
args=[course_id]))
required_fields = ['firstname', 'lastname', 'email']
try:
@@ -2456,7 +2456,7 @@ def upload_users(request, course_id):
dialect=dialect)
except TypeError:
messages.warning(request, "Bad CSV file")
- return my_redirect(reverse('yaksh:course_students',
+ return my_redirect(reverse('yaksh:course_detail',
args=[course_id]))
stripped_fieldnames = [
field.strip().lower() for field in reader.fieldnames]
@@ -2464,11 +2464,11 @@ def upload_users(request, course_id):
if field not in stripped_fieldnames:
msg = "The CSV file does not contain the required headers"
messages.warning(request, msg)
- return my_redirect(reverse('yaksh:course_students',
+ return my_redirect(reverse('yaksh:course_detail',
args=[course_id]))
reader.fieldnames = stripped_fieldnames
_read_user_csv(request, reader, course)
- return my_redirect(reverse('yaksh:course_students', args=[course_id]))
+ return my_redirect(reverse('yaksh:course_detail', args=[course_id]))
def _read_user_csv(request, reader, course):