Extend RedirectView to allow named-URL reversal?
|Reported by:||Simon Meers||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
It would be nice to allow named-URL reversal in the new
class NamedRedirectView(RedirectView): url_name = None def get_redirect_url(**kwargs): if self.url_name: return reverse(url_name) return super(NamedRedirectView, self).get_redirect_url(**kwargs)
I would imagine it is fairly common to want to keep URLconfs DRY, so perhaps this should be built into
RedirectView as an additional option? Of course reversing with args/kwargs is a different story altogether...
Change History (5)
comment:1 Changed 6 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Design decision needed|
comment:4 Changed 3 years ago by
|Status:||closed → new|
|Triage Stage:||Design decision needed → Unreviewed|