Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#23276 closed Cleanup/optimization (fixed)

Deprecate passing views as strings to url()

Reported by: Tim Graham Owned by: Tim Graham
Component: Core (URLs) Version: dev
Severity: Normal Keywords:
Cc: cmawebsite@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Now that we've deprecated patterns() and recommended importing your views module and referencing your view functions (or classes) directly (#22218), it's time to deprecate the "Django String Magic" that lets you use strings as views in url(), e.g. url('^$', 'myapp.views.myview'). (originally raised in #22384)

Change History (13)

comment:1 by Tim Graham, 10 years ago

Has patch: set

comment:2 by Claude Paroz, 10 years ago

Triage Stage: AcceptedReady for checkin

The patch looks good. We might see some more dependency issues with this change in some projects, but hopefully nothing unsolvable.

comment:3 by Collin Anderson, 10 years ago

Is it too late to back-port the docs changes to 1.7, so we stop setting bad examples earlier?

comment:4 by Collin Anderson, 10 years ago

Cc: cmawebsite@… added

comment:5 by Tim Graham, 10 years ago

On backporting the docs, every change conflicts because we also removed patterns() on master so we'd want to backport those doc changes first. I'd welcome a patch, but not sure I want to do it myself.

comment:6 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In a9fd740d22bc4fed5fdb280c036618000ee13df1:

Fixed #23276 -- Deprecated passing views as strings to url().

comment:7 by Collin Anderson, 10 years ago

I'm a little hesitant to remove patterns() unless we also remove it from project_template, but here is a rough backport of this change only in the docs: https://github.com/django/django/pull/3050

If we're ok with removing patterns() from project_template this late in the game (it's just for new projects, right?), I can make a patch for that too.

comment:8 by Collin Anderson <collin@…>, 10 years ago

In 8f9dd9f256239d77ef20d6b4d2f48f08208e504a:

[1.7.x] Refs #23276: Removed bad examples of passing views as strings to url()

partial backport of a9fd740d22 from master

comment:9 by Tim Graham, 10 years ago

I am okay with it.

comment:10 by Collin Anderson <collin@…>, 10 years ago

In e5376999fa9c75efe42ba963a00e2552f66cab9c:

Refs #23276 -- Added missing url() in some places.

comment:11 by Tim Graham <timograham@…>, 9 years ago

In d79122f:

Refs #23276 -- Removed passing views as strings to url() per deprecation timeline.

comment:12 by Tim Graham <timograham@…>, 7 years ago

In 90758055:

Refs #23276 -- Fixed explanation of how calling views works.

"Importing the view" is no longer applicable after
a9fd740d22bc4fed5fdb280c036618000ee13df1.

comment:13 by Tim Graham <timograham@…>, 7 years ago

In c51fdda7:

[1.11.x] Refs #23276 -- Fixed explanation of how calling views works.

"Importing the view" is no longer applicable after
a9fd740d22bc4fed5fdb280c036618000ee13df1.

Backport of 907580557053085578d8de0e1b7309e0e0ed8755 from master

Note: See TracTickets for help on using tickets.
Back to Top