List Info

Thread: URL config, patterns




URL config, patterns
user name
2006-09-30 20:08:49
Hello.

In my app1/urls.py I have something like:

urlpatterns = patterns('probob.app1.views',
        (r'^$', 'index'),
        (r'^test/', 'XXX'),
)

where XXX I want to refer to 'probob.app2.views.foo';
however django is
going to make it refer to
'probob.app.views.probob.app2.views.foo'.  Is
there a way to get around this?

Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

URL config, patterns
user name
2006-09-30 20:14:39
Hi,

> urlpatterns = patterns('probob.app1.views',
>         (r'^$', 'index'),
>         (r'^test/', 'XXX'),
> )
> where XXX I want to refer to 'probob.app2.views.foo';
however django is
> going to make it refer to
'probob.app.views.probob.app2.views.foo'.  Is
> there a way to get around this?
Yes:
urlpatterns = patterns('probob.app1.views',
        (r'^$', 'index'),
)
urlpatterns += patterns('probob.app2.views',
        (r'^test/', 'foo'),
)

Hope it helps,

G

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

URL config, patterns
user name
2006-09-30 20:17:08
thanx for the fast response


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

URL config, patterns
user name
2006-09-30 21:15:21
Ice9 wrote:
> In my app1/urls.py I have something like:
> 
> urlpatterns = patterns('probob.app1.views',
>         (r'^$', 'index'),
>         (r'^test/', 'XXX'),
> )
> 
> where XXX I want to refer to 'probob.app2.views.foo';
however django is
> going to make it refer to
'probob.app.views.probob.app2.views.foo'.  Is
> there a way to get around this?

Beside the trick with adding two lists that Guillermo has
described 
there is a cleaner way available in recent revisions.
Instead of strings 
with path to views you can import actual view functions and
refer them:

     from probob.apps1 import views as views1
     from probob.apps2 import views as views2

     urlpatterns = patterns('',
       (r'^$', views1.index),
       (r'^test/$', views2.XXX),
     )

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )