Model validation inspects models not present in INSTALLED_APPS
|Reported by:||jcugat||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have uploaded a minimal project showing this issue here: https://github.com/jcugat/django-model-validation-bug
This project has two apps (app_a and app_b). app_a has two models: Abstract_User_A (a subclass of Django's AbstractUser), and User_A (a concrete subclass of Abstract_User_A). app_b has only one model: User_B (also a concrete subclass of Abstract_User_A).
In settings.py, only app_b is in INSTALLED_APPS, and the User model is swapped: AUTH_USER_MODEL = 'app_b.User_B'.
Executing manage.py validate shows the following errors:
CommandError: One or more models did not validate: app_b.user_b: Accessor for m2m field 'groups' clashes with related m2m field 'Group.user_set'. Add a related_name argument to the definition for 'groups'. app_b.user_b: Accessor for m2m field 'user_permissions' clashes with related m2m field 'Permission.user_set'. Add a related_name argument to the definition for 'user_permissions'.
The problem is that somehow the validate command is inspecting the model User_A althought it's not installed.
This works OK in Django 1.5.5, but fails in Django 1.6 and master.
Change History (6)
comment:1 Changed 3 years ago by timo
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset