Wednesday, December 30, 2009

Re: reverse drops the project from the url returned

Since your urlconf is passing "case" as a named (keyword) argument, you
(may) have to pass it that way to reverse:

...reverse('case_url', kwargs={'case':case.id})...

Bill

On Mon, Dec 28, 2009 at 8:22 PM, davathar <davathar@gmail.com> wrote:
> I'm stuck on a "reverse" problem.  The 'case' view is supposed to
> record posted info, then reload the same page.  But it's dropping the
> first part of the URL on the redirect and I've not been able to figure
> out why.
>
> It should be going to .com/helpdesk/support/case/1/  But it's going
> to .com/support/case/1/
>
> I'm sure it's something simple as I've had the problem in the past and
> fumbled my way through it.  But I can't find it this time.  Hopefully
> the below pasted lines show all the necessary detail.
>
> Anyone see my error?
>
> helpdesk.urls:
> urlpatterns = patterns('',
>    (r'^support/', include('helpdesk.support.urls')),
> )
>
> helpdesk.support.urls:
> urlpatterns = patterns('helpdesk.support.views',
>    (r'^case/(?P<case>\d+)/$', 'case',{},'case_url' ),
> )
>
> helpdesk.support.views:
> def case(request, case):
>    return HttpResponseRedirect(reverse('case_url', args=(case.id,)))
> # Redirect back here after POST
>
> -Shane
>
> --
>
> 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+unsubscribe@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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate