Hardly unexpected, r49 worked with the Django trunk, but caused issues with older...
authorMichael Elsdoerfer <michael@elsdoerfer.info>
Fri, 8 Jan 2010 23:17:50 +0000 (00:17 +0100)
committerMichael Elsdoerfer <michael@elsdoerfer.info>
Fri, 8 Jan 2010 23:17:50 +0000 (00:17 +0100)
django_tables/models.py

index cfd1d4865b2dac9bf48f27849d02d1484fa779bd..3650edd05653964140ab3762999056ff3d2b058d 100644 (file)
@@ -123,12 +123,12 @@ class BaseModelTable(BaseTable):
                     # Let Django validate the lookup by asking it to build\r
                     # the final query; the way to do this has changed in \r
                     # Django 1.2, and we try to support both versions.\r
-                    _temp = self.queryset.order_by(lookup)\r
+                    _temp = self.queryset.order_by(lookup).query\r
                     if hasattr(_temp, 'as_sql'):\r
-                        _temp.query.as_sql()\r
+                        _temp.as_sql()\r
                     else:\r
                         from django.db import DEFAULT_DB_ALIAS\r
-                        _temp.query.get_compiler(DEFAULT_DB_ALIAS).as_sql()\r
+                        _temp.get_compiler(DEFAULT_DB_ALIAS).as_sql()\r
                     break\r
                 except FieldError:\r
                     pass\r