Opened 51 minutes ago
#37268 new Uncategorized
django 6.1 breaks Media objects with reverse_lazy entries
| Reported by: | alex | Owned by: | |
|---|---|---|---|
| Component: | Forms | Version: | 6.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Problem
sometimes you want to use reverse_lazy for referencing internal urls in forms, widgets and other Media objects.
With the new change to Script, Stylesheet, ... this fails. Both classes cannot lazy load and when a lazy object is defined it is tried to access .__html__() which fails.
What should happen instead is to resolve reverse_lazy when it is really required. Both classes should support lazy objects too.
Why reverse won't work in such situations:
This won't work in admin. Calling reverse too early; e.g. when defining the media object can break the application.