9.4.1 Creating a Webpage to Delete Post
Objects
Much like blog_post_update
, our blog_post_delete
will replicate the path segment used to identify Post
objects found in blog_post_detail
. However, to differentiate blog_post_delete
from either blog_post_detail
or blog_post_detail
, our new URL pattern will append the /delete/
path segment to our regular expression pattern, as shown in Example 9.68.
19 url(r'^(?P<year>\d{4})/' 20 r'(?P<month>\d{1,2})/' 21 r'(?P<slug>[\w\-]+)/' 22 r'delete/$', 23 PostDelete.as_view(), 24 name='blog_post_delete'),
Much like with the update URLs, it is in our interest to build a method ...
Get Django Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.