On Wed, 2008-05-14 at 16:31 +0800, @@ wrote:
> Sorry this previous example is not correct.
> and i know what the problem is, i'm not sure if this is a bug.
>
> my root URLconfs is somehow like this
> urlpatterns = patterns('',
> (r'^app/', include('app.urls')),
> (r'^$', include('app.urls')), # )
>
> the app URLconf is like this
> urlpatterns = patterns('',
> (r'^test/a-test', app.view.test, name='test'),
> (r'^/?$',app.views.index),
> )
>
> the app.urls appear twice in the root urls, because i wan't the app's
> index view be the index view of the site.( and i don't want import the
> app.view.index into the root urlconfs )
> then it will cause the reverse method get the wrong url
> "/test/a-test/" instead of "/app/test/a-test/"
>
Why don't you just replace the second line in your root URLconf with
this then?
(r'^$', 'app.views.index'),
^ ^ quotes here!
>
>
>
> On 5/14/08, @@ <[EMAIL PROTECTED]> wrote:
> Hi,
> It seems the revese method can't work with included URLconfs?
>
> for example :
> the root URLconfs is like this
> urlpatterns = patterns('',
> (r'^app/',
> include('django_website.apps.blog.urls.blog')),
> )
>
> the app URLconfs is like this
> urlpatterns = patterns('',
> (r'^test/a-test', 'app.view', name='test'),
> )
>
> When i want to get the "test" url
> from django.core.urlresolvers import reverse
> reverse('test')
>
> i will get /test/a-test/ instead of /app/test/a-test/
>
> Did i miss something or is there other workarounds?
>
> thanks.
>
>
>
--
http://spinlock.ch/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---