I see that I had mixed the second and third ways of using 'redirect' in the
doc. It seems to be working OK this way:
def upload1(request):
. . .
fout = 'tempfile.csv'
return redirect('/isf/upload2/' + fout + '/')
def upload2(request, filename=None):
. . .
with the following in urls.py:
(r'^app/upload2/(?P<filename>[A-Za-z0-9._-]+)/$', upload2),
Thanks.
I've been working on this while watching a live NASA feed of Curiosity's
landing on Mars. Exciting!
On Sun, Aug 5, 2012 at 11:42 PM, Karen Tracey <[email protected]> wrote:
> On Sun, Aug 5, 2012 at 9:21 PM, forthfan <[email protected]> wrote:
>
>>
>> I'm trying to pass a filepath from one view to another by using
>> 'redirect' from django.shortcuts, but the argument is not getting passed.
>> What am I doing wrong?
>>
>> def upload1(request):
>> if request.method == 'POST':
>> form = UploadFileForm(request.POST, request.FILES)
>> if form.is_valid():
>> filepath = request.FILES['file']
>> return redirect('/app/upload2/', filepath=filepath)
>>
>
> You are passing the hardcoded url to redirect, which will be used as-is
> (per doc:
> https://docs.djangoproject.com/en/1.4/topics/http/shortcuts/#redirect).
> If you want the filepath kwarg to be used to construct the url specified in
> the redirect, you need to pass the name of the view (or url pattern) for
> the view.
>
> Karen
> --
> http://tracey.org/kmt/
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.