diff --git a/generic/forms.py b/generic/forms.py
index 91a3aaab..5230ce39 100755
--- a/generic/forms.py
+++ b/generic/forms.py
@@ -622,13 +622,39 @@ class UserUserGroupForm(ModelForm):
-
+
+
+
+
+
+
+
+
Advanced search tips
+
+ - Basic: type any part of a user's first name, last name, username or email (case-insensitive substring match). Example:
smith or joe@example.com.
+ - Wildcards: use
* or % as the query to return many users (use carefully). Wildcard queries return up to 50 results; normal queries return up to 10.
+ - Field-specific searches: prefix with
field:term to restrict the search. Supported fields:
+
+ name: or full_name: — matches first OR last name (e.g. name:smith).
+ first: or first_name: — matches first name.
+ last: or last_name: — matches last name.
+ email: — matches email address.
+ username: — matches username.
+ id: or pk: — match by numeric user id (e.g. id:123).
+ grade: — match by grade name or grade id (e.g. grade:ST3 or grade:2).
+
+
+ - Grade filter: use the grade dropdown next to the search box to narrow results by trainee grade in addition to your query.
+ - To add users, click the Add button beside a result. If an Add all results button appears, it will add all currently visible results.
+ - If you expect many matches, narrow your query or use a field-specific search to improve relevance and performance.
+
+
@@ -645,6 +671,8 @@ class UserUserGroupForm(ModelForm):
const select = document.getElementById('{field_id}');
const selectedList = document.getElementById('{selected_list_id}');
const gradeSelect = document.getElementById('grade_filter_{self.name}');
+ const helpBtn = document.getElementById('user_search_help_btn_{self.name}');
+ const helpPanel = document.getElementById('user_search_help_panel_{self.name}');
let timeout = null;
function fetchResults(q) {{
@@ -670,6 +698,16 @@ class UserUserGroupForm(ModelForm):
timeout = setTimeout(() => fetchResults(search.value), 50);
}});
+ // Toggle help panel visibility
+ if (helpBtn && helpPanel) {{
+ helpBtn.addEventListener('click', function(e) {{
+ e.preventDefault();
+ helpPanel.classList.toggle('d-none');
+ const expanded = !helpPanel.classList.contains('d-none');
+ helpBtn.setAttribute('aria-expanded', expanded ? 'true' : 'false');
+ }});
+ }}
+
// fieldName for this widget instance
const widgetFieldName = '{self.name}';