If you have your index page as a named url in your urls.py:

url(r'^$', 'index', name='app_index')

Then you can call HttpResponseRedirect as follows:

return HttpResponseRedirect(reverse('app_index'))

No need to directly specify the request object... it will definitely be
available to your index view ;)

--
Joey Espinosa
Python Developer
http://about.me/joelinux
On Apr 11, 2013 7:31 PM, "Nick D" <[email protected]> wrote:

> I'm trying to use the reverse() function to get back to my index, but I'm
> not sure if my view are compatible. My index funtion takes a request ( def
> index(request)). I can't seem to call the reverse function with the request
> object in the args, but if I call the reverse function without any args it
> doesn't find a matching function. I'm sure I'm doing something wrong!
>
> def index(request):
>     latest_wo_list = GIS_WO.objects.all().order_by('-update_timestamp')[:5]
>     return render_to_response('GIS_WO_APP/index.html', {'latest_wo_list':
> latest_wo_list})
>
> def giswo_submit(request, id):
>     p = get_object_or_404(GIS_WO, pk=id)
>     return HttpResponseRedirect(reverse('gis_wo_app.views.index',
> args=(request)))
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to