Address #16855 - Deprecate depth kwarg on select_related. #488

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@mjtamlyn
Member

mjtamlyn commented Nov 2, 2012

This is the start of a deprecation path for the depth kwarg on select_related. Removing this will allow us to update select_related so it chains properly and have a more similar API to prefetch_related.

Address #16855 - Deprecate depth kwarg on select_related.
This is the start of a deprecation path for the depth kwarg on
select_related. Removing this will allow us to update select_related so
it chains properly and have a more similar API to prefetch_related.
@@ -698,6 +699,8 @@ def select_related(self, *fields, **kwargs):
If fields are specified, they must be ForeignKey fields and only those
related objects are included in the selection.
"""
+ if 'depth' in kwargs:
+ warnings.warn('The keyword argument "depth" has been deprecated. Use field names instead.', DeprecationWarning)

This comment has been minimized.

Show comment Hide comment
@aaugustin

aaugustin Nov 2, 2012

Owner

This should be a PendingDeprecationWarning at this time. (Also a \n would help readability.)

@aaugustin

aaugustin Nov 2, 2012

Owner

This should be a PendingDeprecationWarning at this time. (Also a \n would help readability.)

+.. deprecated:: 1.5
+ The ``depth`` parameter to ``select_related()`` has been deprecated. You
+ should replace it with the use of the ``(*fields)`` format instead. See the
+ :doc:`Django 1.5 release notes</releases/1.5>` for more information.

This comment has been minimized.

Show comment Hide comment
@ptone

ptone Nov 3, 2012

Member

FYI - the deprecated sphinx directive automatically inserts a "see release notes" link

@ptone

ptone Nov 3, 2012

Member

FYI - the deprecated sphinx directive automatically inserts a "see release notes" link

This comment has been minimized.

Show comment Hide comment
@ptone

ptone Nov 3, 2012

Member

I'm wrong that is only for version added - but in this case the release note doesn't add much, if anything.

@ptone

ptone Nov 3, 2012

Member

I'm wrong that is only for version added - but in this case the release note doesn't add much, if anything.

@ptone

This comment has been minimized.

Show comment Hide comment
@ptone

ptone Nov 3, 2012

Member

merged with some extra docs modifications in 965cc0b

Member

ptone commented Nov 3, 2012

merged with some extra docs modifications in 965cc0b

@ptone ptone closed this Nov 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment