So, right now when my DetailView subclass doesn't find an object using the PK (which is taken from the URL), I see the 404.html template page. What I'd rather do is just redirect to another URL. Here's my url patterns:
url(r'^(?P<pk>[0-9]+)/$', DeviceDetailView.as_view(
template_name='devices/detail.html',
queryset=Device.objects.all(),
context_object_name="device",
)),
url(r'^$', FullListView.as_view(template_name='devices/devices.html',)),
So, if my url looks like /devices/8/, it uses 8 as the primary key. Works great when 8 exists in the database. However, when 8 doesn't exist, it goes to the 404 page. What I would rather it do is go to a list - in fact, the FullListView listed when last url (which is what happens when the url looks like /devices/nonnumericstuff/.
Seems like that should be pretty easy, no? I don't want all 404's to go there so i can't use handler404.