On Monday, April 11, 2011 12:00:37 AM UTC+1, Antonio Sánchez wrote: > > hi, im trying to use redirect shortcut, but im having problems passing > arguments to the view i want to reverse. > > view definition is this: > > def profile(request, activation_key=None, new=None): > if new is None: > return HttpResponse("You're at the profile.") > else: > return HttpResponse("New User!\nYou're at the profile.") > > > my urls looks like this (and works): > url(r'^profile/(?P<activation_key>\w+)/$', profile, {'new': 1}, > name='profile_view'), > > but in other view, i try to use redirect, doing this: > .... > kwargs['new'] = 1 > return redirect(success_url, **kwargs) > .... > > > I add 'new' parameter and sets it to 1 (just like in url definition!), > but it fails: > Reverse for 'profile_view' with arguments '()' and keyword arguments > '{'new': 1, 'activation_key': > u'ad6ef997beccb16dee9184d1602dad086dfa1b97'}' not found. > > the point is that if i delete that param (new), from view definition, > url, and dont add in the view calls return, it works... > > some idea?? > thanks!
What you are trying to do makes no sense. Redirection sends the browser to another URL. The only parameters that are possible are those in the URL itself. For whatever reason, you have not put your `new` parameter in the URL, but hard-coded it in urls.py. If you need to pass a parameter, put it into the URL (or, alternatively, store it in the session). -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.