#10194: allow model instance as argument to HttpResponseRedirect constructor ------------------------------------------------------------+--------------- Reporter: Daniel Pope <d...@mauveinternet.co.uk> | Owner: jacob Status: assigned | Milestone: 1.1 beta Component: HTTP handling | Version: 1.0 Resolution: | Keywords: shortcut wishlist Stage: Accepted | Has_patch: 1 Needs_docs: 0 | Needs_tests: 1 Needs_better_patch: 1 | ------------------------------------------------------------+--------------- Changes (by russellm):
* needs_better_patch: 0 => 1 * needs_tests: 0 => 1 Comment: A few quick comments: 1. The patch needs tests. This sort of thing is easily testable using the builtin test client. 2. I'm not entirely clear why line 69 (the hasattr(obj, 'get_absolute_url') and obj.get_absolute_url() or obj bit) is required. Is there some condition I'm missing where returning just the object would make sense? The only case I can think of is so you can use redirect() as a shortcut for HttpResponseRedirect(), but frankly, I'd rather see the separation of concerns maintained - HttpResposeRedirect handling a literal URL, and redirect handling the get_absolute_url case. 3. There are a couple of minor PEP8 issues - most notably, extra spaces around function arguments. This is easy for us to fix prior to commit, but it would be even nicer if we didn't have to fix them :-) -- Ticket URL: <http://code.djangoproject.com/ticket/10194#comment:4> Django <http://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 -~----------~----~----~----~------~----~------~--~---