Slide 19
Slide 19 text
routing
# automatically maps GET /products/:id to products#show
# GET /products to products#index
# POST /products to products#create
# DELETE /products/:id to products#destroy
# etc.
resources :products
urlpatterns = patterns('',
# matches the detail method in the products controller
url(r'^products/(?P\d+)/$', products.views.DetailView.as_view(),
name='detail'),
# matches the index method, you get the gist
url(r'^products/$', products.views.IndexView.as_view(), name='index'),
url(r'^products/create/$', products.views.CreateView.as_view(),
name='create'),
url(r'^products/(?P\d+)/delete/$', products.views.DeleteView.as_view(),
name='delete'),
)