#26069 closed Cleanup/optimization (worksforme)
Docs for MyModel._meta.get_fields_with_model() missing info about 'is_relation'
Reported by: | Sven R. Kunze | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | tzanke@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
https://docs.djangoproject.com/en/1.9/ref/models/meta/#migrating-old-meta-api
Docs use source code a explanation:
MyModel._meta.get_fields_with_model(): [ (f, f.model if f.model != MyModel else None) for f in MyModel._meta.get_fields() if not f.is_relation or f.one_to_one or (f.many_to_one and f.related_model) ]
1) Why does get_fields_with_model
return fields with not is_relation
?
2) When does a many_to_one
field not have a related_model
?
3) Is it possible to have a one_to_one
field with no related_model
?
Change History (6)
comment:1 by , 9 years ago
Component: | Database layer (models, ORM) → Documentation |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 9 years ago
What these attributes mean and when they're set is documented in the Field attribute reference.
comment:5 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:6 by , 9 years ago
Cc: | added |
---|
Note:
See TracTickets
for help on using tickets.
GenericForeignKey
I think.Feel free to submit a patch if you are able.