diff --git a/erpnext/public/js/education/lms/components/Article.vue b/erpnext/public/js/education/lms/components/Article.vue index 4678db27bd..eab1424455 100644 --- a/erpnext/public/js/education/lms/components/Article.vue +++ b/erpnext/public/js/education/lms/components/Article.vue @@ -32,7 +32,7 @@ export default { methods: { getContent() { return lms.call('get_content', { - type: this.type, + content_type: this.type, content: this.content }) } diff --git a/erpnext/public/js/education/lms/components/Video.vue b/erpnext/public/js/education/lms/components/Video.vue index 2d791bd29e..29d973a5c6 100644 --- a/erpnext/public/js/education/lms/components/Video.vue +++ b/erpnext/public/js/education/lms/components/Video.vue @@ -55,7 +55,7 @@ export default { methods: { getContent() { return lms.call('get_content', { - type: this.type, + content_type: this.type, content: this.content }) } diff --git a/erpnext/www/lms.py b/erpnext/www/lms.py index 801d76616d..441624476d 100644 --- a/erpnext/www/lms.py +++ b/erpnext/www/lms.py @@ -291,13 +291,15 @@ def get_course_details(course_name): # Functions to get program & course details @frappe.whitelist(allow_guest=True) def get_topics(course_name): - course = frappe.get_doc('Course', course_name) - topics = course.get_topics() - return topics + try: + course = frappe.get_doc('Course', course_name) + return course.get_topics() + except frappe.DoesNotExistError: + frappe.throw(_("Course {0} does not exist.".format(course_name))) @frappe.whitelist() -def get_content(type, content): +def get_content(content_type, content): try: - return frappe.get_doc(type, content) - except: - return None \ No newline at end of file + return frappe.get_doc(content_type, content) + except frappe.DoesNotExistError: + frappe.throw(_("{0} {1} does not exist.".format(content_type, content))) \ No newline at end of file