| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/erp/recruitment/ |
Upload File : |
"""
widgets.py
This page is used to write custom form widget or override some functionalities.
"""
from django import forms
from django.utils.safestring import mark_safe
from horilla import settings
# your your widgets
class RecruitmentAjaxWidget(forms.Widget):
"""
This widget class is used to load the ajax script for the recruitment,
the job position and to the stage.
"""
def render(self, name, value, attrs=None, renderer=None):
# Exclude the label from the rendered HTML
rendered_script = f'<link href="/{settings.STATIC_URL}recruitment/widget/recruitment_widget_style.css">\
</link><script src="/{settings.STATIC_URL}recruitment/widget/recruitmentAjax.js"></script>'
additional_script = f"""
<script id="{name}Script">
$(document).ready(function () {{
$("[for='id_{name}']").remove()
$("#{name}Script").remove()
}});
</script>
"""
attrs = attrs or {}
attrs["required"] = False
return mark_safe(rendered_script + additional_script)