#12663 closed New feature (fixed)
Formalize, refactor, and document Model._meta
Reported by: | Massimiliano | Owned by: | pirosb3 |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | 1.8-alpha |
Cc: | unai@…, pirosb3, cmawebsite@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When creating a view template for a Model instance, it is often useful to display the fields in the same order as they were defined.
The Model._meta has many useful tools when you are in such a situation, for example Model._meta.fields, but they are undocumented.
So documentation should be added to http://docs.djangoproject.com/en/1.1/ref/models/options/
Attachments (1)
Change History (28)
comment:1 by , 15 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 15 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Triage Stage: | Unreviewed → Someday/Maybe |
@ubernostrum - Jacob and I spoke briefly about this the other day, in the context of database routers. Although we didn't come to a final decision, I think it is inevitable that we will have to formally document at least parts of _meta. In particular, there are some really ancient parts like app_label and get_field() that haven't changed, even since pre-magic removal, aren't really like to change in the future, and if they did change, would break so much code in the wild that it would be a backwards incompatibility in practice, if not in name.
I'll mark this someday/maybe since it is on the plan; if someone gets really enthused, we might be able to make a first cut for 1.2.
comment:3 by , 15 years ago
milestone: | 1.2 |
---|
Deferring; if nobody has made a start on this, it won't get done for 1.2.
comment:4 by , 14 years ago
Needs documentation: | set |
---|---|
Owner: | changed from | to
Status: | reopened → new |
Version: | 1.2-alpha → SVN |
by , 14 years ago
Attachment: | document-meta.diff added |
---|
comment:8 by , 14 years ago
Now that r15110 landed, I'll be redoing this commit to be clean against those changes.
comment:9 by , 14 years ago
Has patch: | set |
---|---|
milestone: | → 1.3 |
Needs documentation: | unset |
Triage Stage: | Someday/Maybe → Accepted |
comment:10 by , 14 years ago
milestone: | 1.3 |
---|---|
Triage Stage: | Accepted → Someday/Maybe |
@timo - it's great that you're taking a look at this ticket, but it can't happen for 1.3. This is an unusal case where it's not just a matter of documentation. When we document something, it becomes stable API. *Most* of the contents of _meta is *effectively* stable API, but we need to have a discussion about which parts of _meta should be stable, which parts should be private, and which parts should be cleaned up (and there are more than a few of those bits).
If you want to tackle this as a 1.4 task (including driving the relevant discussion on django-dev), that would be awesome; but I don't see it happening for 1.3.
comment:11 by , 14 years ago
Thanks for the response Russ -- figured I might get some pushback on this at this point.
comment:12 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:15 by , 11 years ago
Cc: | added |
---|
comment:16 by , 11 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Someday/Maybe → Accepted |
Hi!
I will pick this up as SoC 2014, where I will be refactoring Meta: https://docs.google.com/document/d/1yp2_skqkxyrc0egdRv6ofnRGCI9nmvxDFBkCXgy0Jwo/edit#
For anything, ping me on #django-dev or on the Google Groups
comment:17 by , 11 years ago
Patch needs improvement: | set |
---|
comment:19 by , 10 years ago
Component: | Documentation → Database layer (models, ORM) |
---|---|
Summary: | Information provided by Model._meta should be documented in <djangodocs>/models/options/ → Formalize, refactor, and document Model._meta |
comment:20 by , 10 years ago
Keywords: | 1.8-alpha added; Model Meta Documentation removed |
---|
comment:21 by , 10 years ago
Cc: | added |
---|
comment:22 by , 10 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:23 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
This is still considered internal API and subject to change; documenting it would commit us to a stability and backwards-compatibility guarantee I don't think we can make at the moment.