refactor: learn page

This commit is contained in:
Anand Chitipothu
2021-05-06 06:57:00 +05:30
parent 761f36519e
commit 88457a82ac
3 changed files with 19 additions and 6 deletions

View File

@@ -9,7 +9,7 @@
{% endblock %}
{% block content %}
{{ Sidebar(course_slug, batch_code) }}
{{ Sidebar(course.name, batch.name) }}
<div class="container">
{{ CourseBasicDetail(course)}}
{{ InstructorsSection(course.get_instructor()) }}

View File

@@ -7,7 +7,7 @@
{% endblock %}
{% block content %}
{{ Sidebar(course, batch_code) }}
{{ Sidebar(course.name, batch.name) }}
<div class="container">
</div>
{% endblock %}

View File

@@ -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