Re: RedirectView with query_string = True and urlencoded unicode string
You have passed 'anything' as a keyword argument that will get passed into your view. Unfortunately, you can't access it in your inline constructor call. Try subclassing RedirectView in views.py of your app.
class SubRedirectView(RedirectView):
query_string = True
def get_redirect_url(self, **kwargs):
return '/tmovil/planes/%s' % self.kwargs.get('anything', None)
~Drew
-- ~Drew
On Mon, May 14, 2012 at 2:30 PM, Sławek Ehlert <slafs.e@gmail.com> wrote:
As the error states:
You don't have a format argument in your '/tmovil/planes/%(anything)s' string.
Cheers
Dnia 14.05.2012 23:19, Germán napisał(a):Hi. Please excuse my ignorance in this affairs.
For an specific URI, I have the following errorTraceback (most recent call last):File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 111, in get_responseresponse = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/generic/base.py", line 47, in viewreturn self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/generic/base.py", line 68, in dispatchreturn handler(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/generic/base.py", line 151, in geturl = self.get_redirect_url(**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/generic/base.py", line 146, in get_redirect_urlreturn url % kwargs
TypeError: not enough arguments for format string
The version I use is 1.3.1, and the urls.py line determining the redirection is(r'^planes/((?P<anything>.*))', RedirectView.as_view(url='/tmovil/planes/%(anything)s', query_string=True)),Is it possible the bug reported in ticket 16842 is cause for this error? If not, should I file a bug?
Thanks--
On Saturday, August 13, 2011 12:47:30 AM UTC-4, Karen Tracey wrote:On Thu, Aug 11, 2011 at 10:48 AM, Slafs wrote:
--Should i report a ticket?
Yes please, that's a bug in Django.
Karen
http://tracey.org/kmt/
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/SebYILZBuMAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home