﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33272	Non-installed model error isn't raised if the module is in the submodule of an installed app	David Seddon	nobody	"Imagine a Django project with two apps:

- `foo` -  included in `INSTALLED_APPS`.
- `foo.bar` - not included in `INSTALLED_APPS`.

If a model from `foo.bar` is imported, I would expect Django to error along these lines:

{{{
RuntimeError: Model class foo.bar.SomeModel doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
}}}

However, instead it imports successfully. Only when the application queries the database will it run into an error, as the table for the model will never have been created.

The root cause is `get_containing_app_config`, which just looks for the innermost installed application that is a parent of the model.

I wonder if there is a way to detect that the model isn't actually part of an installed app?"	Uncategorized	closed	Database layer (models, ORM)	3.2	Normal	invalid		James Owen	Unreviewed	0	0	0	0	0	0
