#33272: Non-installed model error isn't raised if the module is in the 
submodule of
an installed app
-------------------------------------+-------------------------------------
               Reporter:  David      |          Owner:  nobody
  Seddon                             |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Database   |        Version:  3.2
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 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?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33272>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.5dc35067f81e312ac3c3a075bd96e9ab%40djangoproject.com.

Reply via email to