Fixed #23886 -- Displaying 410 page instead of 500 on outdated docs sites

I fixed an error that caused [exceptions on outdated docs pages](https://code.djangoproject.com/ticket/23886). 

I also tested this on the new redesign branch, it works there if you're wondering. Should I write some tests for that bug fix? This view doesn't have any tests yet as far as I can see.

> (Happy [24pullrequests.com](http://24pullrequests.com/)! :gift:)