#22497 closed Cleanup/optimization (fixed)
Documentation should highlight the different between field and class deconstruction
Reported by: | Owned by: | Tim Graham | |
---|---|---|---|
Component: | Documentation | Version: | 1.7-beta-2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm looking at the documentation on https://docs.djangoproject.com/en/1.7/topics/migrations/ for the deconstruct()
method, where it states:
It takes no arguments, and should return a tuple of 3 things: (path, args, kwargs).
But, it actually should return 4 items as shown in the code:
https://github.com/django/django/blob/stable/1.7.x/django/db/migrations/state.py#L127
Change History (4)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Summary: | Documentation for deconstruct is wrong → Documentation should highlight the different between field and class deconstruction |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
I too was confused by this at first.
For Fields a 4-tuple including the field name is returned. Documented here: https://docs.djangoproject.com/en/1.7/howto/custom-model-fields/#field-deconstruction
For other custom classes a 3-tuple is returned. Documented here: https://docs.djangoproject.com/en/1.7/topics/migrations/#custom-deconstruct-method
The latter text should probably mention and link to the former.