Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#22497 closed Cleanup/optimization (fixed)

Documentation should highlight the different between field and class deconstruction

Reported by: reames@… Owned by: timo
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 Changed 15 months ago by nliberg

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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.

comment:2 Changed 15 months ago by timo

  • Owner changed from nobody to timo
  • Status changed from new to assigned
  • Summary changed from Documentation for deconstruct is wrong to Documentation should highlight the different between field and class deconstruction
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

comment:3 Changed 15 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In b829d53b37946d5e3148e2c51ae7ec41f470b756:

Fixed #22497 -- Highlighted difference between field and class deconstruction.

Thanks nliberg for the suggestion.

comment:4 Changed 15 months ago by Tim Graham <timograham@…>

In 63ae243a13759f2a87184784fa268d6d003c694a:

[1.7.x] Fixed #22497 -- Highlighted difference between field and class deconstruction.

Thanks nliberg for the suggestion.

Backport of b829d53b37 from master

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