[Django] #30515: Document django.shortcuts.resolve_url

37 views
Skip to first unread message

Django

unread,
May 27, 2019, 8:50:59 PM5/27/19
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url
------------------------------------------------+------------------------
Reporter: sage | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
The documentation for django.shortcuts currently doesn't document
`resolve_url`. However, the section for
[https://docs.djangoproject.com/en/2.2/topics/http/shortcuts/#redirect
redirect] pretty much explains how `resolve_url` works. It would be
helpful to document `resolve_url` and state that `redirect` uses
`resolve_url` in its process.

--
Ticket URL: <https://code.djangoproject.com/ticket/30515>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 28, 2019, 1:28:46 AM5/28/19
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: sage | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => wontfix


Comment:

Thanks for this ticket, however as you mentioned the way how `redirect()`
resolves URLs is already described in documentation. I don't see many (if
any) use cases for `resolve_url()` (beyond the current), hence adding it
to shortcuts can be confusing for users. IMO this should remain part of
internal API.

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:1>

Django

unread,
Jun 4, 2019, 4:32:42 PM6/4/19
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: sage | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adam (Chainz) Johnson):

* status: closed => new
* resolution: wontfix =>


Comment:

I disagree, I think this could be pretty useful and it seems well
documented internally already

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:2>

Django

unread,
Jun 4, 2019, 4:33:01 PM6/4/19
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: sage | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Adam (Chainz) Johnson):

* cc: Adam (Chainz) Johnson (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:3>

Django

unread,
Jun 5, 2019, 12:47:10 AM6/5/19
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: sage | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

The way how `resolve_url()` works is already described in the
[https://docs.djangoproject.com/en/2.2/topics/http/shortcuts/#redirect
redirect()] documentation. Have you checked it? Can you describe any use
cases for `resolve_url()` (except the current)?


Please see
[https://docs.djangoproject.com/en/stable/internals/contributing/triaging-
tickets/#closing-tickets follow triaging guidelines with regards to
wontfix tickets.]

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:4>

Django

unread,
Jun 6, 2019, 3:00:22 AM6/6/19
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: sage | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => wontfix


Comment:

Eeek. This goes back ''some way''.
[https://code.djangoproject.com/ticket/15552#comment:9 From #15552]:

> I placed it in utils because I wasn't sure you'd want resolve_url as
part of the "public" shortcuts module.
> But if that is ok I'll update the patch.

To which Jannis replied:

> Yeah, that's fine.

"Yes that's fine, it can be part of the public API" vs "Yes, that's fine
to put it there, but we'll leave it private"? — Not sure.

Either way it was never documented.

I can see a use-case: wanting the URL for a `get_context_data()` maybe
(but I can't remember ever using this myself: I'd be inclined to want to
know if I had a model or a view name and a URL at the call site; by the
time I don't know that I've discovered `resolve_url()` anyhow.)

_Meh_...

Closing in line with TicketClosingReasons/DontReopenTickets. Happy to look
at a patch and/or discuss on django-developers but... 🤷‍♀️

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:5>

Django

unread,
Jun 7, 2019, 4:11:08 AM6/7/19
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: sage | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adam (Chainz) Johnson):

Okay fair enough, I don't care that much about making it documented and
public. I can imagine other use cases like creating a custom redirect()
that sends a 307 or 308 but I guess they're quite niche.

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:6>

Django

unread,
Jun 14, 2023, 11:15:36 AM6/14/23
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: Sage Abdullah | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: dev
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Adam Johnson):

I've seen another use case, which lead me to create duplicate ticket
#34650 because I'm a fool who doesn't check for old ones.

The new use case is htmx redirect responses, which django-htmx provides
wrappers for like [https://django-
htmx.readthedocs.io/en/latest/http.html#django_htmx.http.HttpResponseClientRedirect
HttpResponseClientRedirect]. These are a different kind of redirect
response but their usage can still benefit from the convenience of
`resolve_url()`, as I found in a client project.

Also see these GitHub code search results:
https://github.com/search?q=NOT+%28path%3A**%2F__init__.py+OR+path%3A**shortcuts.py%29+%22django.shortcuts%22+resolve_url&type=code&ref=advsearch

They reveal usage in 4.1k files including popular packages Wagtail, and
django-allauth.

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:7>

Django

unread,
Dec 19, 2025, 9:25:14 AM12/19/25
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
--------------------------------------+------------------------------------
Reporter: Sage Abdullah | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Jacob Walls):

* stage: Unreviewed => Accepted

Comment:

Accepting based on the [https://forum.djangoproject.com/t/documentation-
of-django-shortcuts-resolve-url/43561 forum discussion].
--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:8>

Django

unread,
Dec 19, 2025, 9:25:26 AM12/19/25
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
--------------------------------------+------------------------------------
Reporter: Sage Abdullah | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Jacob Walls):

* resolution: wontfix =>
* status: closed => new

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:9>

Django

unread,
Dec 21, 2025, 6:05:04 PM12/21/25
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: Sage Abdullah | Owner: Duane
Type: | Hilton
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Duane Hilton):

* owner: nobody => Duane Hilton
* status: new => assigned

Comment:

PR for this ticket: https://github.com/django/django/pull/20441
--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:10>

Django

unread,
Dec 21, 2025, 6:19:36 PM12/21/25
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: Sage Abdullah | Owner: Duane
Type: | Hilton
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Duane Hilton):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:11>

Django

unread,
Dec 26, 2025, 9:16:19 AM12/26/25
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: Sage Abdullah | Owner: Duane
Type: | Hilton
Cleanup/optimization | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:12>

Django

unread,
Dec 26, 2025, 10:29:16 AM12/26/25
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: Sage Abdullah | Owner: Duane
Type: | Hilton
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nessita <124304+nessita@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"626c15dba0662d5b9f61cc7eddf985e514293d6f" 626c15d]:
{{{#!CommitTicketReference repository=""
revision="626c15dba0662d5b9f61cc7eddf985e514293d6f"
Fixed #30515 -- Documented resolve_url() in
docs/topics/http/shortcuts.txt.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:13>

Django

unread,
Dec 26, 2025, 10:29:16 AM12/26/25
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: Sage Abdullah | Owner: Duane
Type: | Hilton
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by nessita <124304+nessita@…>):

In [changeset:"6c2780ffe1aaf526e01287f9d0805143c23c7920" 6c2780ff]:
{{{#!CommitTicketReference repository=""
revision="6c2780ffe1aaf526e01287f9d0805143c23c7920"
Refs #30515 -- Added tests for resolve_url() with view callables and
arguments.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:14>

Django

unread,
Dec 26, 2025, 10:31:06 AM12/26/25
to django-...@googlegroups.com
#30515: Document django.shortcuts.resolve_url.
-------------------------------------+-------------------------------------
Reporter: Sage Abdullah | Owner: Duane
Type: | Hilton
Cleanup/optimization | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia <124304+nessita@…>):

In [changeset:"90daa655486c7fc69e9dad41c5e96f00339a3b9b" 90daa65]:
{{{#!CommitTicketReference repository=""
revision="90daa655486c7fc69e9dad41c5e96f00339a3b9b"
[6.0.x] Fixed #30515 -- Documented resolve_url() in
docs/topics/http/shortcuts.txt.

Backport of 626c15dba0662d5b9f61cc7eddf985e514293d6f from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30515#comment:15>
Reply all
Reply to author
Forward
0 new messages