November 2015
Beginner to intermediate
840 pages
26h 30m
English
Post ObjectsTo uniquely identify a Post, we need a year, a month, and a slug. However, if we simply identify the object, we will be in conflict with our blog_post_detail URL pattern. We need to differentiate our new blog_post_update URL from blog_post_detail, so we append the /update/ path segment to the regular expression pattern, anticipating the creation of PostUpdate, as shown in Example 9.40.
Example 9.40: Project Code
3 from .views import ( 4 PostCreate, PostList, PostUpdate, post_detail) . ... 6 urlpatterns = [ . ... 18 url(r'^(?P<year>\d{4})/' 19 r'(?P<month>\d{1,2})/' 20 r'(?P<slug>[\w\-]+)/' ...
Read now
Unlock full access