feat: contact us
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import add_months, get_link_to_form, getdate
|
||||
from frappe.utils import add_months, get_link_to_form, getdate, validate_url
|
||||
from frappe.utils.user import get_system_managers
|
||||
|
||||
from lms.lms.utils import generate_slug, validate_image
|
||||
@@ -16,7 +16,7 @@ class JobOpportunity(Document):
|
||||
self.company_logo = validate_image(self.company_logo)
|
||||
|
||||
def validate_urls(self):
|
||||
frappe.utils.validate_url(self.company_website, True)
|
||||
validate_url(self.company_website, True)
|
||||
|
||||
def autoname(self):
|
||||
if not self.name:
|
||||
|
||||
@@ -67,7 +67,11 @@
|
||||
"meta_description",
|
||||
"meta_image",
|
||||
"column_break_xijv",
|
||||
"meta_keywords"
|
||||
"meta_keywords",
|
||||
"contact_us_tab",
|
||||
"contact_us_email",
|
||||
"column_break_gcgv",
|
||||
"contact_us_url"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -416,13 +420,32 @@
|
||||
"fieldname": "programming_exercises",
|
||||
"fieldtype": "Check",
|
||||
"label": "Programming Exercises"
|
||||
},
|
||||
{
|
||||
"fieldname": "contact_us_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Contact Us"
|
||||
},
|
||||
{
|
||||
"fieldname": "contact_us_email",
|
||||
"fieldtype": "Data",
|
||||
"label": "Contact Us Email"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_gcgv",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "contact_us_url",
|
||||
"fieldtype": "Data",
|
||||
"label": "Contact Us URL"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2025-08-12 16:47:49.983018",
|
||||
"modified": "2025-10-03 17:41:30.904723",
|
||||
"modified_by": "sayali@frappe.io",
|
||||
"module": "LMS",
|
||||
"name": "LMS Settings",
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import get_url_to_list
|
||||
from frappe.utils import get_url_to_list, validate_email_address, validate_url
|
||||
|
||||
|
||||
class LMSSettings(Document):
|
||||
def validate(self):
|
||||
self.validate_google_settings()
|
||||
self.validate_signup()
|
||||
self.validate_contact_us_details()
|
||||
|
||||
def validate_google_settings(self):
|
||||
if self.send_calendar_invite_for_evaluations:
|
||||
@@ -45,6 +46,12 @@ class LMSSettings(Document):
|
||||
if self.has_value_changed("disable_signup"):
|
||||
frappe.db.set_single_value("Website Settings", "disable_signup", self.disable_signup)
|
||||
|
||||
def validate_contact_us_details(self):
|
||||
if self.contact_us_email and not validate_email_address(self.contact_us_email):
|
||||
frappe.throw(_("Please enter a valid Contact Us Email."))
|
||||
if self.contact_us_url and not validate_url(self.contact_us_url, True):
|
||||
frappe.throw(_("Please enter a valid Contact Us URL."))
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def check_payments_app():
|
||||
|
||||
Reference in New Issue
Block a user