mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
[Major][Breaking] Modified Course Doctype, added Topic based functions
This commit is contained in:
@@ -277,7 +277,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fieldname": "course_content",
|
"fieldname": "course_topic",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
@@ -286,10 +286,10 @@
|
|||||||
"in_global_search": 0,
|
"in_global_search": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"in_standard_filter": 0,
|
"in_standard_filter": 0,
|
||||||
"label": "Course Content",
|
"label": "Course Topic",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"options": "Course Content",
|
"options": "Course Topic",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
@@ -478,7 +478,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2018-11-08 13:30:33.423194",
|
"modified": "2018-12-12 12:40:50.372457",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Education",
|
"module": "Education",
|
||||||
"name": "Course",
|
"name": "Course",
|
||||||
|
|||||||
@@ -25,10 +25,18 @@ class Course(Document):
|
|||||||
content_list = [item for item in contents if item.doctype!="Quiz"]
|
content_list = [item for item in contents if item.doctype!="Quiz"]
|
||||||
return content_list, quiz_list
|
return content_list, quiz_list
|
||||||
|
|
||||||
|
def get_topics(self):
|
||||||
|
try:
|
||||||
|
topic_list = self.get_all_children()
|
||||||
|
topic_data = [frappe.get_doc("Topic", topic.topic) for topic in topic_list]
|
||||||
|
except frappe.DoesNotExistError:
|
||||||
|
return None
|
||||||
|
return topic_data
|
||||||
|
|
||||||
def get_contents(self):
|
def get_contents(self):
|
||||||
try:
|
try:
|
||||||
course_content_list = self.get_all_children()
|
topics = self.get_topics()
|
||||||
content_data = [frappe.get_doc(course_content.content_type, course_content.content) for course_content in course_content_list]
|
content_data = [{'name':topic.name, 'topic_name': topic.topic_name ,'content':topic.get_contents()} for topic in topics]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return None
|
return None
|
||||||
return content_data
|
return content_data
|
||||||
|
|||||||
Reference in New Issue
Block a user