From 3e46db9c1163af864c186ee5aba8b913d83d7d9a Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 7 Feb 2022 12:01:07 +0530 Subject: [PATCH] feat: multiple instructors --- .../lms/doctype/course_instructor/__init__.py | 0 .../course_instructor/course_instructor.json | 32 +++++++++++++++++++ .../course_instructor/course_instructor.py | 8 +++++ school/lms/doctype/lms_course/lms_course.json | 8 ++--- school/patches.txt | 1 + school/patches/v0_0/multiple_instructors.py | 4 +++ 6 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 school/lms/doctype/course_instructor/__init__.py create mode 100644 school/lms/doctype/course_instructor/course_instructor.json create mode 100644 school/lms/doctype/course_instructor/course_instructor.py create mode 100644 school/patches/v0_0/multiple_instructors.py diff --git a/school/lms/doctype/course_instructor/__init__.py b/school/lms/doctype/course_instructor/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/school/lms/doctype/course_instructor/course_instructor.json b/school/lms/doctype/course_instructor/course_instructor.json new file mode 100644 index 00000000..3ef8630a --- /dev/null +++ b/school/lms/doctype/course_instructor/course_instructor.json @@ -0,0 +1,32 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2022-02-07 11:39:59.998762", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "instructor" + ], + "fields": [ + { + "fieldname": "instructor", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Instructor", + "options": "User" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2022-02-07 11:41:42.943250", + "modified_by": "Administrator", + "module": "LMS", + "name": "Course Instructor", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/school/lms/doctype/course_instructor/course_instructor.py b/school/lms/doctype/course_instructor/course_instructor.py new file mode 100644 index 00000000..d229178c --- /dev/null +++ b/school/lms/doctype/course_instructor/course_instructor.py @@ -0,0 +1,8 @@ +# Copyright (c) 2022, Frappe and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + +class CourseInstructor(Document): + pass diff --git a/school/lms/doctype/lms_course/lms_course.json b/school/lms/doctype/lms_course/lms_course.json index 86b7e5d1..2a4b0c25 100644 --- a/school/lms/doctype/lms_course/lms_course.json +++ b/school/lms/doctype/lms_course/lms_course.json @@ -105,11 +105,10 @@ }, { "fieldname": "instructor", - "fieldtype": "Link", - "in_list_view": 1, + "fieldtype": "Table MultiSelect", "in_standard_filter": 1, "label": "Instructor", - "options": "User" + "options": "Course Instructor" }, { "fieldname": "section_break_7", @@ -168,7 +167,7 @@ "link_fieldname": "course" } ], - "modified": "2021-09-30 10:36:48.759995", + "modified": "2022-02-07 11:41:39.735324", "modified_by": "Administrator", "module": "LMS", "name": "LMS Course", @@ -190,6 +189,7 @@ "search_fields": "title", "sort_field": "creation", "sort_order": "DESC", + "states": [], "title_field": "title", "track_changes": 1 } \ No newline at end of file diff --git a/school/patches.txt b/school/patches.txt index 4ce65a63..c7c9cce3 100644 --- a/school/patches.txt +++ b/school/patches.txt @@ -21,3 +21,4 @@ execute:frappe.delete_doc("DocType", "LMS Topic") #06-10-2021 school.patches.v0_0.add_progress_to_membership #20-10-2021 execute:frappe.delete_doc("Workspace", "LMS", ignore_missing=True, force=True) #24-10-2021 execute:frappe.delete_doc("Custom Field", "User-verify_age", ignore_missing=True, force=True) +school.patches.v0_0.multiple_instructors diff --git a/school/patches/v0_0/multiple_instructors.py b/school/patches/v0_0/multiple_instructors.py new file mode 100644 index 00000000..1da27ace --- /dev/null +++ b/school/patches/v0_0/multiple_instructors.py @@ -0,0 +1,4 @@ +import frappe + +def execute(): + frappe.get_all("LMS Course", fields=["name", "instructor"])