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)

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

Download all attachments as: .zip

Change History (10)

comment:1 by Aymeric Augustin, 11 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Mitar, 11 years ago

Cc: mmitar@… added

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

comment:3 by Aymeric Augustin, 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 Aymeric Augustin, 11 years ago

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 by Aymeric Augustin, 11 years ago

Keywords: 1.9 added

This ticket cannot move forward until Django 1.9.

comment:6 by pirosb3, 11 years ago

Cc: pirosb3 added

by Aymeric Augustin, 10 years ago

Attachment: 21682.diff added

comment:7 by Aymeric Augustin, 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 Tim Graham, 9 years ago

Keywords: 1.9 removed

comment:9 by Simon Charette, 2 years ago

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