Redirect with parameters. NoReverseMatch at /test/
django
Solution
When using the `redirect()` shortcut you're actually doing a `HttpResponseRedirect()` and therefore need not to include the response in your `kwargs`.
Furthermore if you would like to redirect with keyworded arguments then the call would be
redirect('/myurl/', momma="im comin' home")
or
redirect('/myurl/', kwargs={'loads_a_kwargs':'cowboy'})
The error you're getting is because your regexp `url(r'^demo/', 'demo', name='demo')` does not accept any parameters. Also, normally you would end all your url regexes with `$` to denote that the capturing should stop.
Problem
views.py: ``` def demo(request, **kwargs): print response ...... def test(request): ...... kwargs = {'response': response} return redirect('demo', **kwargs) ``` urls.py: ``` from django.conf.urls import patterns, url from django.contrib.sitemaps.views import sitemap urlpatterns = patterns('clients.views', url(r'^test/', 'test', name='test'), url(r'^demo/', 'demo', name='demo'), ) ``` Why I have this error: NoReverseMatch at /test/ Reverse for 'demo' with arguments '()' and keyword arguments '{'response': {u'status': u'ok'}}' not found. Request Method: POST Request URL: http ://127.0.0.1:8000/test/