Thanks for the reply, Bruno. For some reason, that still doesn't work for
me. I can't figure out how to get reverse to work at all. But I took your
advice about HttpResponseRedirect and this worked fine:

return HttpResponseRedirect('../')

Since my path structure is: myProject/myApp/samurai/samurai_id/add_item
All I need to do is back up one.

I was always trying to put views in HttpResponseRedirect. I think I'll just
stick with urls.

-Tim


On Thu, Feb 25, 2010 at 3:51 AM, bruno desthuilliers <
bruno.desthuilli...@gmail.com> wrote:

> On Feb 25, 1:15 am, Timothy Kinney <timothyjkin...@gmail.com> wrote:
> > I have two views:
> > samurai_detail
> > add_item_to_samurai
> >
> > There is a button in samurai_detail that links to add_item_to_samurai.
> > The templates are the same except that add_item_to_samurai includes a
> > form to add an item.
> >
> > After posting the form, I want to redirect back to samurai_detail (the
> > page without the form that shows the items).
> >
> > As in the Django documentation, I thought I could do this with a
> > redirect, like so:
> > return redirect('samurai_detail')
> >
> > But this returns: Reverse for 'samurai_detail' with arguments '()' and
> > keyword arguments '{}' not found.
>
> I personnaly still stick to using an HttpResponseRedirect with an
> explicit call to reverse - mostly because I failed to spot this new
> shortcut FWIW !-)
>
> > This is a little bit cryptic. I think it says it can't find my view.
>
> What it says is that it fails to find any url definition that would
> call the samurai_detail view _without any argument_.
>
> > Both views are contained in myproject.myapp.admin_views.py
> >
> > Am I using reverse() incorrectly? How can I redirect to the
> > samurai_detail view?
>
> What's the signature of your samurai_detail view ?
>
> Ok, assuming it's defined as
>
> def samurai_detail(request, samurai_id):
>  # code
>
> you could try either:
>
>  return redirect('samurai_detail', samurai.id)
>
> or
>
>  return redirect('samurai_detail', samurai_id=samurai.id)
>
> My 2 cents...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@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