9.4.2 Creating a Webpage to Delete NewsLink Objects

Our NewsLinkDelete view suffers from the same quirk that our NewsLinkUpdate view does. Because we don’t have a URL-safe string unique identifier for NewsLink objects, we are forced to use the primary key of the row in the database, contrary to the principle of readable URLs. We sort this all out in Chapter 10, but for the moment, we build a rather unfriendly URL pattern, as shown in Example 9.75.

Example 9.75: Project Code

organizer/urls.py in cd1e78c2bd

13      url(r'^newslink/delete/(?P<pk>\d+)/$', 14          NewsLinkDelete.as_view(), 15          name='organizer_newslink_delete'),

Even without a unique identifier, we still take the opportunity to define a ...

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.