Opened 14 years ago
Closed 14 years ago
#16129 closed Cleanup/optimization (wontfix)
FormView's "success_url" attr should accept named URLs
| Reported by: | renatopedigoni | Owned by: | nobody |
|---|---|---|---|
| Component: | Generic views | Version: | 1.3 |
| Severity: | Normal | Keywords: | |
| Cc: | renatopedigoni@… | Triage Stage: | Design decision needed |
| Has patch: | yes | Needs documentation: | yes |
| Needs tests: | yes | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
IMHO success_url should also accept named urls. I wrote a very simple patch that uses 'redirect' (from django.shortcuts) instead of HttpResponseRedirect.
Attachments (1)
Change History (3)
by , 14 years ago
| Attachment: | patch.diff added |
|---|
comment:1 by , 14 years ago
| Needs documentation: | set |
|---|---|
| Needs tests: | set |
| Patch needs improvement: | set |
| Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 14 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
Closing WONTFIX for the reasons aaugustin gave.
Note:
See TracTickets
for help on using tickets.
I'm -1 on this patch for the following reasons:
*argsor**kwargstoredirect;success_url, and I don't think that makes sense here;redirectis not very well defined, it does more magic than necessary here, see the source: <quote># If this doesn't "feel" like a URL, re-raise.</quote>. Ugh.I think
django.shortcutsin general, andredirectin particular, are little hacks to ease developers' lives, and not something that should be used in Django itself. Currently,django.shortcutsis only used in contrib apps, never in the core; and the only functions used areget_object_or_404andrender_to_response. Both of these are more straightforward thanredirect; they don't do any magic.I think
success_url = urlresolvers.reverse(my_url_name)is explicit and works in your situation.However, since I'm not 100% sure that we don't want this feature, I'll mark the ticket as DDN and let a core developer make the decision. If it's accepted, the patch still needs tests and documentations.