Fixed#16502 -- Fixed a TemplateDoesNotExist error that should be an ImproperlyConfigured.
Assistance on the patch from #jambronrose.
Backport of 9b2dc12b83 from master.
This also updates all dependent functionality, including modelform_factory
and modelformset_factory, and the generic views `ModelFormMixin`,
`CreateView` and `UpdateView` which gain a new `fields` attribute.