#12344: select_related() uses always QuerySet and Query classes from originating Model ---------------------------------------------------+------------------------ Reporter: jtiai | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: SVN Resolution: | Keywords: query orm Stage: Unreviewed | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ---------------------------------------------------+------------------------ Changes (by jtiai):
* keywords: gis query orm Oracle => query orm * component: GIS => Database layer (models, ORM) * summary: Mixing geo and nongeo with select_related() doesn't work with Oracle => select_related() uses always QuerySet and Query classes from originating Model Comment: When you have models just like in description and both have different, custom !QuerySet containing managers using .select_related() fails. This is because Django assumes that all related models uses same !QuerySet (and Query) as originating table, in case of example !ModelNormal. This is most visible with GeoDjango models since many of them uses custom decorations to produce WKT text from spatial column and trying to use normal, nongeomodel as a originating model and .select_related() fails with exceptions. Note: In multidb branch this appears to be problem of sql compiler that expects that all related models uses same compiler as originating model. Which for example in GeoDjango models case is not true - they have their own compiler that adds spatial field decorations to queries causing different errors on different spatial backends. -- Ticket URL: <http://code.djangoproject.com/ticket/12344#comment:2> Django <http://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-upda...@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.