diff --git a/community/www/courses/about/index.html b/community/www/courses/about/index.html
index 02d9336a..1ea0ab1f 100644
--- a/community/www/courses/about/index.html
+++ b/community/www/courses/about/index.html
@@ -9,7 +9,7 @@
{% endblock %}
{% block content %}
-{{ Sidebar(course_slug, batch_code) }}
+{{ Sidebar(course.name, batch.name) }}
{{ CourseBasicDetail(course)}}
{{ InstructorsSection(course.get_instructor()) }}
diff --git a/community/www/courses/learn/index.html b/community/www/courses/learn/index.html
index 61321fde..a2a07f82 100644
--- a/community/www/courses/learn/index.html
+++ b/community/www/courses/learn/index.html
@@ -7,7 +7,7 @@
{% endblock %}
{% block content %}
-{{ Sidebar(course, batch_code) }}
+{{ Sidebar(course.name, batch.name) }}
{% endblock %}
diff --git a/community/www/courses/learn/index.py b/community/www/courses/learn/index.py
index 6219b647..83b3df0e 100644
--- a/community/www/courses/learn/index.py
+++ b/community/www/courses/learn/index.py
@@ -1,8 +1,21 @@
import frappe
-from community.www.courses.utils import redirect_if_not_a_member
+from community.lms.models import Course
def get_context(context):
context.no_cache = 1
- context.course = frappe.form_dict["course"]
- context.batch_code = frappe.form_dict["batch"]
- redirect_if_not_a_member(context.course, context.batch_code)
+
+ course_name = frappe.form_dict["course"]
+ batch_name = frappe.form_dict["batch"]
+
+ course = Course.find(course_name)
+ if not course:
+ context.template = "www/404.html"
+ return
+
+ batch = course.get_batch(batch_name)
+ if not batch:
+ frappe.local.flags.redirect_location = "/courses/" + course_name
+ raise frappe.Redirect
+
+ context.course = course
+ context.batch = batch