KristianOellegaard/django-hvad — pull request #188 by spectras (2014-06-14 06:00:02+00:00)
Title: Remove custom model metaclass

This PR moves the code that customizes `TranslatableModel` subclasses from the `TranslatableModelBase` metaclass into a signal handler, connected to Django's builtin `class_prepared`. It gets triggered almost at the same point, but does not conflict with other metaclass-using apps.

Here is the detailed list of changes:
- empty out `TranslatableModelBase` and mark it as deprecated.
- move its `__new__` method to a `prepare_translatable_model` signal handler.
- clean up the signal handler code: running a bit later, it needs less introspection to gather required data.
- force `_base_manager` to be an instance of `TranslationManager` or a subclass. This was actually missing from the metaclass code. Unnoticed as parts of Django that use `_base_class` handle features we do not support yet.
- move the associated `contribute_translations` out of the model, next to the signal handler. It has no business inside the model class and polluted its namespace.

Tests pass. No behavior change was expected.