#21988: reverse() shouldn't require kwargs for uniquely determined named groups -----------------------------+-------------------- Reporter: cjerdonek | Owner: nobody Type: New feature | Status: new Component: Core (URLs) | Version: 1.6 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -----------------------------+-------------------- For DRY purposes, it can be useful to capture a known substring in an URL for access from a view. For example--
{{{ url(r'^(?P<action>create)/confirm/$', ConfirmCreateView.as_view(), name='confirm_create') url(r'^(?P<action>change)/confirm/$', ConfirmChangeView.as_view(), name='confirm_change') }}} Calling `reverse()` for examples like the above still requires passing the keyword argument though (`action='create'` or `action='change'` in these examples), even though the value of the keyword argument isn't necessary to construct the corresponding URL. This makes calling `reverse()` less DRY than it needs to be. I would like to suggest making `reverse()` not require the keyword arguments in cases where the corresponding named groups have only one possible value. If this isn't possible to add, are there any suggestions for a DRY way to accomplish the same thing? -- Ticket URL: <https://code.djangoproject.com/ticket/21988> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.57fa0f458055451157e5fd44e21cffb2%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.