﻿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
4144	ModelBase should only check `sys.modules` when it needs to	Marty Alchin <gulopine@…>	Adrian Holovaty	"Currently, `ModelBase.__new__` retrieves a model's module through `sys.modules`, in order to detect the model's `app_label`. However, this check is made even if the model provides an `app_label` on its `Meta` class. Since retrieval of `app_label` is the only use of this check, I've attached a patch that moves it into the `if` block, so it only executes if `app_label` was ''not'' provided in the model's `Meta`.

For what it's worth, this is important for a project of mine, as I'm hoping to generate models during runtime, rather than through Python source. I'm looking to design models interactively, even load them with data and test out relationships. Sort of a rapid-prototyping for Django, capable of being used even by non-coders, since it wouldn't rely on typing any Python code.

I know this is very much a corner case, but the fact remains that this check is really only used within that `if` statement, and it seems it could just as easily go there without any trouble."		closed	Database layer (models, ORM)	dev		fixed			Ready for checkin	1	0	0	0	0	0
