#16129: FormView's "success_url" attr should accept named URLs
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  renatopedigoni                     |         Status:  new
                   Type:             |      Component:  Generic views
  Cleanup/optimization               |       Severity:  Normal
              Milestone:             |       Keywords:
                Version:  1.3        |      Has patch:  1
             Resolution:             |    Needs tests:  1
           Triage Stage:  Design     |  Easy pickings:  0
  decision needed                    |
    Needs documentation:  1          |
Patch needs improvement:  1          |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

 * needs_better_patch:   => 1
 * needs_docs:   => 1
 * needs_tests:   => 1
 * stage:  Unreviewed => Design decision needed


Comment:

 I'm -1 on this patch for the following reasons:

 - that would only work for named urls that don't have any captures, since
 you can't pass `*args` or `**kwargs` to `redirect`;
 - that would allow passing a model instance as `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, and `redirect` 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 are
 `get_object_or_404` and `render_to_response`. Both of these are more
 straightforward than `redirect`; 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16129#comment:1>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to