#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 , 11 years ago
| Has patch: | set |
|---|
comment:2 by , 11 years ago
| Triage Stage: | Accepted → Ready 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 , 11 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 , 11 years ago
| Cc: | added |
|---|
comment:5 by , 11 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 , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:7 by , 11 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.
PR