Opened 9 years ago

Closed 10 months 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)

21682.diff (3.7 KB) - added by Aymeric Augustin 8 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 9 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

comment:2 Changed 9 years ago by Mitar

Cc: mmitar@… added

Could here be also added that you do not want a model to be registered?

comment:3 Changed 9 years ago by Aymeric Augustin

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 Changed 9 years ago by Aymeric Augustin

Summary: Move relevant fields from Model._meta to Model._meta.app_configUse 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:5 Changed 9 years ago by Aymeric Augustin

Keywords: 1.9 added

This ticket cannot move forward until Django 1.9.

comment:6 Changed 9 years ago by pirosb3

Cc: pirosb3 added

Changed 8 years ago by Aymeric Augustin

Attachment: 21682.diff added

comment:7 Changed 8 years ago by Aymeric Augustin

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 Changed 8 years ago by Tim Graham

Keywords: 1.9 removed

comment:9 Changed 10 months ago by Simon Charette

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top