On Sep 30, 5:05 pm, Matt <mattsp...@gmail.com> wrote:
> I'm using the redirect() function provided in Django 
> 1.1:http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#django.sh...
>
> I have a view:
> my_editing_view(request, id, args={})
>
> for which the URL is:
> url(r'^/edit/(?P<id>.+)$', 'views.my_editing_view')
>
> And I'd like to redirect to that view from another view such that I
> set BOTH id and args.
>
> That is:
> some_id = ...
> some_args = ...
> redirect('my_editing_view', id=some_id, args=some_args)
>
> I'm able to do the following:
> redirect('my_editing_view', id=some_id)
>
> Is there a way to pass these extra args without having to include them
> in the URL?  Sorry if this is basic, but I'm new to Django.
>
> Thanks,
> Matt

But what is 'args'? You're not including it in the urlpattern, so how
can it be passed to the view? If you mean as querystring parameters
(eg /myview/?x=1&y=2), these aren't passed as arguments to the view at
all, but are accessed via request.GET - you do have to add these on to
the URL manually, but can easily convert them from a dictionary via
django.utils.http,urlencode,

(Not related, but note that you should never use a dict or a list as a
default argument in a function definition: see
http://www.ferg.org/projects/python_gotchas.html#contents_item_6 for
why.)
--
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to