Extend RedirectView to allow named-URL reversal?
|Reported by:||DrMeers||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 RedirectView.
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 5 years ago by anonymous
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed
comment:3 Changed 4 years ago by tomv2
- Easy pickings set
- Resolution set to fixed
- Status changed from new to closed
comment:4 Changed 2 years ago by timo
- Has patch set
- Resolution fixed deleted
- Status changed from closed to new
- Triage Stage changed from Design decision needed to Unreviewed
- UI/UX unset