diff --git a/onboarding/templates/onboarding/rejection/form.html b/onboarding/templates/onboarding/rejection/form.html index 595945762..4c3829a9a 100644 --- a/onboarding/templates/onboarding/rejection/form.html +++ b/onboarding/templates/onboarding/rejection/form.html @@ -1,7 +1,29 @@ -
- {{form.as_p}} +{% load i18n %} + + {{ form.as_p }}
diff --git a/onboarding/urls.py b/onboarding/urls.py index 6fb055d99..70e28f63f 100644 --- a/onboarding/urls.py +++ b/onboarding/urls.py @@ -142,6 +142,11 @@ urlpatterns = [ views.add_to_rejected_candidates, name="add-to-rejected-candidates", ), + path( + "delete-candidate-rejection//", + views.delete_candidate_rejection, + name="delete-candidate-rejection", + ), path( "candidate-select-filter-onboarding", views.candidate_select_filter, diff --git a/onboarding/views.py b/onboarding/views.py index 0eb1b4a25..9fa7d0228 100644 --- a/onboarding/views.py +++ b/onboarding/views.py @@ -1802,6 +1802,25 @@ def add_to_rejected_candidates(request): return render(request, "onboarding/rejection/form.html", {"form": form}) +@login_required +@hx_request_required +@permission_required("recruitment.delete_rejectedcandidate") +def delete_candidate_rejection(request, rej_id): + """ + This method is used to delete candidate rejection + """ + try: + instance = RejectedCandidate.objects.filter(id=rej_id).first() + if instance: + instance.delete() + messages.success(request, "Candidate rejection deleted successfully") + else: + messages.error(request, "Candidate rejection not found") + except Exception as e: + messages.error(request, "Error occurred while deleting candidate rejection") + return HttpResponse("") + + @login_required def candidate_select(request): """