Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24758 closed Bug (fixed)

Incorrect docstring in Options.get_fields()

Reported by: Eric Zarowny Owned by: nobody
Component: Documentation Version: 1.8
Severity: Normal Keywords: _meta, documentation
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

According to the docstring for Options.get_fields():

Returns a list of fields associated to the model. By default will only return forward fields.

However, the call to _get_fields does not set reverse=False when its default is True. I can't really tell if this was intentional or not. I would be happy to make a patch / pull request to fix this either way.

Change History (4)

comment:1 by Tim Graham, 9 years ago

Component: Database layer (models, ORM)Documentation
Has patch: set
Triage Stage: UnreviewedAccepted

Proposed update of the docstring:

  • django/db/models/options.py

    diff --git a/django/db/models/options.py b/django/db/models/options.py
    index a76b934..eb09269 100644
    a b class Options(object):  
    755755
    756756    def get_fields(self, include_parents=True, include_hidden=False):
    757757        """
    758         Returns a list of fields associated to the model. By default will only
    759         return forward fields. This can be changed by enabling or disabling
    760         field types using the parameters:
     758        Returns a list of fields associated to the model. By default will
     759        include forward and reverse fields, fields derived from inheritance,
     760        but not hidden fields. The returned fields can be changed by using the
     761        parameters:
    761762
    762763        - include_parents: include fields derived from inheritance
    763764        - include_hidden:  include fields that have a related_name that

comment:2 by Tim Graham, 9 years ago

Summary: Options.get_fields() returns reverse fieldsIncorrect docstring in Options.get_fields()

comment:3 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In b99114f6:

Fixed #24758 -- Corrected Options.get_fields() docstring.

comment:4 by Tim Graham <timograham@…>, 9 years ago

In 6a7b27c:

[1.8.x] Fixed #24758 -- Corrected Options.get_fields() docstring.

Backport of b99114f67f0e5eba3b1d31641906b75a14fd2fa0 from master

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