#28029: Removal of ability to reverse by dotted path found to be very non-DRY
--------------------------------------------+------------------------
Reporter: Henrik Levkowetz | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (URLs) | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+------------------------
I've been using django for the site `datatracker.ietf.org` for about 10
years now, updating to new Django releases along the way. I've almost
always appreciated the features of each new release, but release 1.10
brought this feature removal:
* The ability to reverse() URLs using a dotted Python path is removed.
(https://docs.djangoproject.com/en/1.10/releases/1.10/#features-
removed-in-1-10)
The site (datatracker.ietf.org) has about 750 distinct URL patterns, and
we've been very good at referencing URLs using `{% url %}` in our
templates, and using `django.url.reverse()` in code. Given that the
dotted url names previously provided gave a consistent DRY way of
referring to the URL belonging to a given view function, we used it
extensively.
This means that in order to upgrade to 1.10 I was suddenly faced with the
task of manually naming ~750 URL patterns with unique and meaningful
names, and potentially updating many thousands of places using reverse URL
lookup in code and templates, for no apparent benefit.
The ticket which removed reversal by dotted path, #22384, also removed the
ability to refer to view functions by strings in `url()`. To be clear:
This ticket is not about that change. I found that a bit inconvenient,
and it seems to me that it increases the risk of import loops, but that
change is '''not''' what I'm contesting here; it's only the removal of the
built-in ability to reverse by dotted path that I find very non-DRY.
In the end I replaced `django.conf.urls.url()` with a wrapper that
generated a dotted-url-path name based on the view function, which mostly
restored the pre-1.10 functionality; but having to do that seems to me to
be very contrary to the batteries-included approach we're proud of.
--
Ticket URL: <https://code.djangoproject.com/ticket/28029>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.05111cd962b4c0a59ecab8e536a0ff78%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.