Repository navigation
remove jquery from RecordForm to fix Place - Resource autocomplete on… - #333
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the change removing duplicate jQuery initialization from the shared RecordForm template.
No open issues 🎉
What changed in this PR
This PR addresses the Activity form’s Place–Resource autocomplete regression by avoiding duplicate jQuery initialization in the shared RecordForm template.
Changes:
- Removes explicit loading of jQuery and
jquery.init.js. - Retains the existing
django.jQueryinstance so Select2 remains available to autocomplete widgets.
| File | Description |
|---|---|
TEKDB/TEKDB/templates/admin/RecordForm.html |
Removes duplicate jQuery scripts to preserve autocomplete plugin registration. |
Review effort: Balanced
rhodges
left a comment
There was a problem hiding this comment.
Looks good to me. I called out a potential need to delete cruft files from the repo (if they're not used elsewhere) to keep things clean, but consolidating on one jQuery to rule them all makes too much sense: good work!
| <link rel="stylesheet" href="/static/assets/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css"> | ||
| <link rel="stylesheet" href="/static/TEKDB/css/record_form.css"> | ||
| <script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.js"></script> | ||
| <script type="text/javascript" src="/static/admin/js/jquery.init.js"></script> |
There was a problem hiding this comment.
Removing these broken references and relying solely on Django's jQuery sounds great!
Are these two files referenced elsewhere? If not - please delete them from the repo.
There was a problem hiding this comment.
They are imported in templates/admin/index.js and jQuery is used on the admin page for things like the import + export modals. I think we need to keep those imports.
asana task
Description
While preparing for the workshop, I noticed that the autocomplete for place-resources on the Activity form did not appear. Debugging with Copilot helped zero in on the root cause of the issue: Re-loading jQuery replaces django.jQuery with an instance lacking the Select2 plugin, which breaks django-autocomplete-light widgets. This bug was originally fix in this commit and re-introduced in this commit.
Screenshots
Before:

After:
