Opened 3 years ago
Closed 3 years ago
#33692 closed New feature (wontfix)
urlize to accept target attribute as parameter
Reported by: | Timothy Schilling | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | |
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
The anchor tag in HTML supports a target attribute (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-target) that has a set number of options. It is helpful to be able to control the user's nagivation by specifying whether a link on a page opens in the current view or in a new tab/window.
I propose adding a new parameter to the internal API django.utils.html.urlize and the public template filters urlize
and urlizetrunc
.
Change History (3)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Ah, that will do for me. I probably should have come up with that myself.
I'd be happy to write up the PR for this if there's consensus on adding it. Otherwise this can be closed as the workaround is sufficient.
comment:3 by , 3 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Thanks Tim! In that case, let's say wontfix
as no-code beats code 9 times out of 10 🙂
Stack Overflow has a suggestion here:
Example of usage:
https://stackoverflow.com/questions/2295725/extending-urlize-in-django
I don't know if that's good enough finally, or whether it's worth adding the API here, but it would serve as a workaround.