|Reported by:||Aymeric Augustin||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
This method checks for the case when the same model is imported through two different Python paths. This check has lost its purpose with the new project layout introduced in Django 1.4.
Furthermore, if the check fails, the second model replaces the first one in the app registry. This behavior seems error-prone. Having two models with the same name in the same app should be an error.
In my opinion:
- the check for identity should be removed, most likely with a deprecation path for people who haven't switched to the new project layout yet.
- register_models should raise an exception when attempting to register two models with the same name.