Override settings max recursion error (#17011)

Changed implementation of @override_settings for decorated classes to monkeypatching.

https://code.djangoproject.com/ticket/17011