fix: validation for URL
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
{{ submission }}
|
||||
|
||||
<div class="field-group">
|
||||
<div class="bold-heading">
|
||||
{{ _("Submit")}}
|
||||
|
||||
Reference in New Issue
Block a user