God you'r right !

Thanks to your answer i found why my "named" url didn't work.

I wrote this in my urls.py :
    (r'^article/(?P<id>\d+)/$', myAppFront.views.article, name='article'),
instead of :
   *url*(r'^article/(?P<id>\d+)/$', myAppFront.views.article,
name='article'),

AND, you'r right, i didn't use the name i defined (here 'article') in my
redirection.

Thx you Tom :)

On Mon, Oct 24, 2011 at 5:52 PM, Tom Evans <tevans...@googlemail.com> wrote:

> On Mon, Oct 24, 2011 at 12:34 PM, nicolas HERSOG <n.her...@gmail.com>
> wrote:
> > Hi everyone,
> > I digged more but i'm still stuck.
> > I understood that i have to use namespaceURL.
> > So i modified my url.py this way :
> > from myAppFront.views import article
> >     url (r'^article/(?P<id>\d+)/$',
> >         myAppFront.views.article,
> >         name='article'),
>
> Note: this doesn't namespace it, it gives it the explicit name
> 'article'. If you gave it a name like 'myApp:article' it would be in
> the myApp namespace, or if the entire urlconf is included in the main
> urlconf with a namespace, but you don't mention doing that.
>
> > and this is my addComment view :
> > ...
> >     #return HttpResponseRedirect(reverse('myAppFront.views.article',
> > args=(id,)))
> >     return HttpResponseRedirect(reverse('myAppFront.views.article',
> > kwargs={'id': id}))
>
> Having named it, you can (and should) use the name when reversing the
> URL, not the view definition, eg:
>
>  return HttpResponseRedirect(reverse('article', args=(id,)))
>
> You could also use the dict syntax as well, I prefer the tuple version
> for simple single argument URLs like this.
>
> Hope that helps
>
> Cheers
>
> Tom
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to