fix: Make Content hidden and added validation

This commit is contained in:
shariquerik 2021-08-19 12:42:43 +05:30
parent b96b4c90f7
commit 461dfd6c6e
2 changed files with 11 additions and 7 deletions

View file

@ -28,7 +28,6 @@
"pin_to_bottom",
"hide_custom",
"public",
"content_section",
"content",
"section_break_2",
"charts_label",
@ -39,6 +38,7 @@
"section_break_18",
"cards_label",
"links",
"roles_section",
"roles"
],
"fields": [
@ -239,14 +239,10 @@
"fieldtype": "Data",
"label": "Parent Page"
},
{
"fieldname": "content_section",
"fieldtype": "Section Break",
"label": "Content"
},
{
"fieldname": "content",
"fieldtype": "Long Text",
"hidden": 1,
"label": "Content"
},
{
@ -259,10 +255,15 @@
"fieldtype": "Table",
"label": "Roles",
"options": "Has Role"
},
{
"fieldname": "roles_section",
"fieldtype": "Section Break",
"label": "Roles"
}
],
"links": [],
"modified": "2021-08-05 11:49:09.028243",
"modified": "2021-08-19 12:36:29.825169",
"modified_by": "Administrator",
"module": "Desk",
"name": "Workspace",

View file

@ -17,6 +17,9 @@ class Workspace(Document):
frappe.throw(_("You need to be in developer mode to edit this document"))
validate_route_conflict(self.doctype, self.name)
if isinstance(self.content, list):
frappe.throw(_("Content data shoud be a list"))
duplicate_exists = frappe.db.exists("Workspace", {
"name": ["!=", self.name], 'is_default': 1, 'extends': self.extends
})