Skip to content

remove jquery from RecordForm to fix Place - Resource autocomplete on… - #333

Merged
paigewilliams merged 1 commit into
developfrom
fix-place-resource-relationship
Nov 13, 2026
Merged

paigewilliams merged 1 commit into
developfrom
fix-place-resource-relationship

Conversation

@paigewilliams

Copy link
Copy Markdown
Collaborator

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:
Screenshot 2026-11-13 at 1 29 02 PM

After:
Screenshot 2026-11-13 at 1 51 58 PM

@paigewilliams
paigewilliams requested review from pollardld and rhodges and a balanced review from Copilot November 13, 2026 21:53
@paigewilliams paigewilliams self-assigned this Nov 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.jQuery instance 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 rhodges left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pollardld pollardld left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@paigewilliams
paigewilliams merged commit f15f989 into develop Nov 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants