Hello Claude,

Generally speaking, you cannot safely use a model that isn't defined in an 
application that is in INSTALLED_APPS. Django raises a warning when you import 
such a model.

This restriction prevents situations where relations between models aren't set 
up correctly. There’s a string of such bugs in Trac. I discussed this in my 
DjangoCon Europe 2014 talk.

Best regards,

-- 
Aymeric.



> On 18 nov. 2015, at 21:04, Claude Paroz <[email protected]> wrote:
> 
> Hello,
> 
> I have a Django project with different apps and settings. Let's say settings 
> A have A in INSTALLED_APPS but not B, and settings B have B in INSTALLED_APPS 
> but not A. Note also that I cannot have both apps installed, for some reason.
> In that configuration and from Django 1.9, ./manage.py test will always fail 
> with the message :
>     RuntimeError: Model class <myapp.models.MyModel> doesn't declare an 
> explicit app_label and either isn't in an application in INSTALLED_APPS or 
> else was imported before its application was loaded.
> 
> Do we admit that for such type of projects, you always have to specify your 
> app labels starting from Django 1.9?
> Or did I miss some hidden trick to avoid that?
> 
> Claude
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/django-developers 
> <http://groups.google.com/group/django-developers>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/b7d021c5-bc44-48e6-8441-b57a40758c53%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-developers/b7d021c5-bc44-48e6-8441-b57a40758c53%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/EE28FB5F-A248-41E1-8248-E56DB5E540F2%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to