fix: validation for URL

This commit is contained in:
Jannat Patel
2023-08-30 13:10:22 +05:30
parent 4a76f42e35
commit ccb7c1485b
2 changed files with 6 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import validate_url
class LMSAssignmentSubmission(Document):
@@ -40,9 +41,13 @@ def upload_assignment(
if assignment_type == "URL" and not answer:
frappe.throw(_("Please enter the URL for assignment submission."))
if assignment_type == "File" and not assignment_attachment:
frappe.throw(_("Please upload the assignment file."))
if assignment_type == "URL" and not validate_url(answer):
frappe.throw(_("Please enter a valid URL."))
if submission:
doc = frappe.get_doc("LMS Assignment Submission", submission)
else:

View File

@@ -91,7 +91,7 @@
</div>
</div>
{% else %}
{{ submission }}
<div class="field-group">
<div class="bold-heading">
{{ _("Submit")}}