Page 14-15 Confusion


#1

On page 14 you say to add:

url(r'^$', views.index, name='home'),

Then on page 15 you say:

'collection.views.index' means that we’ll use the index view in views.py in our app collection, which we’ll do next.

We use views.index and it works, but you are referencing ‘collection.views.index’. Not sure if this is intentional but it is really confusing.


#2

You’re right, that’s a tricky part about Python. On P14, the full changeset was:

 from django.conf.urls import patterns, url

 from django.contrib import admin
+from collection import views

 urlpatterns = [
+  url(r'^$', views.index, name='home'),
   url(r'^admin/', include(admin.site.urls)),
 ]

Notice the import statement, that says that the “views” we’re referring to was imported from collection. So in effect, it’s collection.views.index as you deduced. :)