Opened 17 months ago

Last modified 3 months ago

#21682 new New feature

Use app_config as a reference instead of app_label in Options (Model._meta)

Reported by: aaugustin Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: app-loading 1.9
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 aaugustin 3 months ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 17 months ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 16 months ago by mitar

  • Cc mmitar@… added

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

comment:3 Changed 16 months ago by aaugustin

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 16 months ago by aaugustin

  • Summary changed from Move relevant fields from Model._meta to Model._meta.app_config to 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:5 Changed 16 months ago by aaugustin

  • Keywords 1.9 added

This ticket cannot move forward until Django 1.9.

comment:6 Changed 14 months ago by pirosb3

  • Cc pirosb3 added

Changed 3 months ago by aaugustin

comment:7 Changed 3 months ago by aaugustin

I took a stab at this, unfortunately, it doesn't play well with the fake "migrations" app label declared by the Migration model.

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