Skip to content

Build admin read-only field links from DOM nodes - #5627

Merged
obenland merged 1 commit into
mainfrom
admin-readonly-links
Oct 13, 2026
Merged

obenland merged 1 commit into
mainfrom
admin-readonly-links

Conversation

@obenland

Copy link
Copy Markdown
Member

Description

The link helper on the media change form turned bare URLs in read-only fields into links by rebuilding each field from an HTML string. It now splits the field text on the URL pattern and appends text and anchor nodes, so the field text stays exactly as rendered.

Two format_html calls that pre-interpolated their arguments now pass them as placeholders. Django deprecates the argument-less form in 5.x and removes it in 6.0.

Testing Instructions

  1. Open any image or audio item in the Django admin.
  2. Confirm the attribution and licence URL fields still render their URLs as clickable links.
  3. Run ov just api/test -k "templates or admin".

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 13, 2026 13:38
@obenland
obenland requested a review from a team as a code owner October 13, 2026 13:38
@obenland obenland added 🟩 priority: low Low priority and doesn't need to be rushed 💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟨 tech: javascript Involves JavaScript 🐍 tech: python Involves Python 🧱 stack: api Related to the Django API labels Oct 13, 2026
@obenland
obenland requested review from dhruvkb and krysal and removed request for a team October 13, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The link helper on the media change form rebuilt each read-only field
from an HTML string. It now splits the field text and appends text and
anchor nodes instead, which keeps the text exactly as rendered.

Two format_html calls that pre-interpolated their arguments now pass
them as placeholders, which Django 6 will require.

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
@obenland
obenland force-pushed the admin-readonly-links branch from 9be4899 to ae77789 Compare October 13, 2026 14:15
@obenland
obenland merged commit 639e926 into main Oct 13, 2026
48 checks passed
@obenland
obenland deleted the admin-readonly-links branch October 13, 2026 14:33
@github-project-automation github-project-automation Bot moved this from 👀 Needs Review to 🤝 Merged in Openverse PRs Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: api Related to the Django API 🟨 tech: javascript Involves JavaScript 🐍 tech: python Involves Python

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants