Since you're a "reverse" newbie, I'll also mention that you can pass url
variables when you call it. Given this url:

url(r'^books/(?P<book_id>\d+)/details/', 'detail_view',
name='books_detail_view')

You would call reverse like this (assume that you already have the desired
book in a variable called target_book):

reverse('books_detail_view', kwargs={'book_id': target_book.id})

Just a tip.

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

> Joe,
>
> Thanks for looking into it. The app isn't actually doing anything yet.
> Eventually I'll have the submit do some work and redirect to a more useful
> page.
>
> Thanks again for your help.
>
> On Thursday, April 11, 2013 4:44:18 PM UTC-7, JoeLinux wrote:
>
>> Keep in mind that your "p" variable won't be available to your index view
>> on a redirect, so I'm just working on the assumption that you just posted a
>> small code snippet and you're actually doing something with it beforehand.
>>
>> --
>> Joey Espinosa
>> Python Developer
>> http://about.me/joelinux
>> On Apr 11, 2013 7:42 PM, "Nick D" <[email protected]> wrote:
>>
>>> I got it, thanks Joe!
>>>
>>>
>>> url(r'^$', 'index', name='gis_wo_index'),
>>>
>>>
>>>
>>> return HttpResponseRedirect(reverse('**gis_wo_index'))
>>>
>>> On Thursday, April 11, 2013 4:31:26 PM UTC-7, Nick D 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 django-users...@**googlegroups.com.
>>> To post to this group, send email to [email protected].
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en>
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<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.
>
>
>

-- 
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