Opened 11 years ago
Closed 2 years ago
#21682 closed New feature (wontfix)
Use app_config as a reference instead of app_label in Options (Model._meta)
Reported by: | Aymeric Augustin | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | app-loading |
Cc: | mmitar@…, pirosb3 | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This is a very general idea for which I don't have a clear proposal yet.
Attachments (1)
Change History (10)
comment:1 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 11 years ago
Cc: | added |
---|
comment:3 by , 11 years ago
Well... What's the use case?
The fact that models are registered is a private implementation detail that isn't described anywhere in the documentation.
comment:4 by , 11 years ago
Summary: | Move relevant fields from Model._meta to Model._meta.app_config → Use app_config as a reference instead of app_label in Options (Model._meta) |
---|
In fact, the real question this ticket asks is -- should the Options class take an app_config in argument rather than an app_label?
I'm changing the title accordingly.
We aren't guaranteed to have an app_config available as long as:
- models can live outside of installed applications (#21680)
- applications / application configurations can import models (#21719)
I'm not sure we'll make drastic choices on these two tickets.
This ticket is likely to end up as wontfix, but it's probably worth keeping until the dust of app-loading settles (after the 1.7 release).
comment:6 by , 11 years ago
Cc: | added |
---|
by , 10 years ago
Attachment: | 21682.diff added |
---|
comment:7 by , 10 years ago
I took a stab at this, unfortunately, it doesn't play well with the fake "migrations" app label declared by the Migration model.
comment:8 by , 9 years ago
Keywords: | 1.9 removed |
---|
comment:9 by , 2 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Finally going to resolve this ticket as wontfix. As pointed out by Aymeric there are complications wrt/ to migration fake models and quite frankly it's not clear to me what benefits it would provide over the rare cases where self.apps(self.app_label)
is used.
Could here be also added that you do not want a model to be registered?