#14694: defer() doesn't work with reverse relations -------------------------------------+------------------------------------- Reporter: sayane | Owner: nobody Type: Bug | Status: reopened Component: Database layer | Version: SVN (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: defer only | Needs documentation: 0 OneToOneField reverse | Patch needs improvement: 1 relationship | UI/UX: 0 Has patch: 1 | Needs tests: 0 | Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by mrmachine): I think I've finally cracked it. When working with model instances that have deferred fields, you need to call `get_fields_with_model()` on the original model to get non-local fields correctly. You can access the opts for the original model with `rel_obj._meta.proxy_for_model._opts`. I have just updated the patch. The full test suite passes, so I think this is RFC now, but I will wait for review by more a set of eyes more experienced with the ORM. -- Ticket URL: <https://code.djangoproject.com/ticket/14694#comment:8> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.