Migrated function to class-based generic views.