Fix for integrity constraint violation when importing a page with a
different template from the version that already existed. Primarily a
fix for the http404 page which is not deletable, but likely relevant
for other pages too. Thanks to @jlahijani for reporting.