On 12/09/2011 03:06 AM, Reinout van Rees wrote:
On 09-12-11 01:28, Jim Byrnes wrote:
from django.conf.urls.defaults import *
from mysite import views
from mysite.views import hello, current_datetime, hours_ahead,
display_meta
from django.contrib import admin
from mysite.contact import views
from mysite.books import views

admin.autodiscover()

urlpatterns = patterns('',
(r'^hello/$', hello),
(r'^time/$', current_datetime),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
(r'^admin/' , include(admin.site.urls)),
(r'^contact/$',views.contact),
(r'^search-form/$', views.search_form), #from mysite.books
(r'^search/$', views.search), # from mysite.books

)

mysite.contact.views might very well have a contact() method, but
mysite.books.views probably does not.

And you're importing 'views' a couple of times at the top. The last
"from mysite.books import views" is winning :-) You cannot have one
variable point to several things at the same time.

Best thing you can do:

import mysite.contact.views
import mysite.books.views
...
(r'^contact/$', mysite.contact.views.contact),




Reinout


That worked and your explanation gave me a better understanding of how the process works.


Thanks,  Jim

--
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