Opened 13 years ago
Closed 13 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 , 13 years ago
Attachment: | patch.diff added |
---|
comment:1 by , 13 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 13 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:
*args
or**kwargs
toredirect
;success_url
, and I don't think that makes sense here;redirect
is 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.shortcuts
in general, andredirect
in particular, are little hacks to ease developers' lives, and not something that should be used in Django itself. Currently,django.shortcuts
is only used in contrib apps, never in the core; and the only functions used areget_object_or_404
andrender_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.