Opened 10 years ago

Closed 9 years ago

#23918 closed Cleanup/optimization (wontfix)

Built in functions override custom functions in related manager

Reported by: Matthew Somerville Owned by: nobody
Component: Documentation Version: 1.7
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

The fix for #23611 (released in Django 1.7.1) broke some relatively old, but stable and working, code that is okay on Django 1.4 up to and including 1.7. You can see the difference between 1.7 and 1.7.1 in this Travis build on a minimal Django project: https://travis-ci.org/dracos/django-related-bug/builds/42139875

The issue appears to be that now update_or_create is made available on related managers, it overrides the method defined on the model manager. Which is fine, but unexpected, especially as it was okay in 1.7 itself. I can just rename the method (and/or switch it to behave more identically to 1.7's method of the same name for eventual replacement with it), but I thought it was worth raising here as a possible confusion, or just to check if custom functions of the same name should be overriding built in functions.

Change History (2)

comment:1 by Tim Graham, 10 years ago

Component: Database layer (models, ORM)Documentation
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

I believe this is intentional (I assume other methods like get() and filter(), etc. work the same way). We could better document the backwards-incompatible nature of the change in the release notes though.

comment:2 by Tim Graham, 9 years ago

Resolution: wontfix
Status: newclosed

Since the 1.7 release is rather old by now, I guess there isn't much value in documenting this now.

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