From 43184b7c76a94f4e6ee148ee9f6c4d4fc648dc78 Mon Sep 17 00:00:00 2001 From: Michael Elsdoerfer Date: Sat, 9 Jan 2010 00:17:50 +0100 Subject: [PATCH] Hardly unexpected, r49 worked with the Django trunk, but caused issues with older versions. Now both should work. --- django_tables/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django_tables/models.py b/django_tables/models.py index cfd1d48..3650edd 100644 --- a/django_tables/models.py +++ b/django_tables/models.py @@ -123,12 +123,12 @@ class BaseModelTable(BaseTable): # Let Django validate the lookup by asking it to build # the final query; the way to do this has changed in # Django 1.2, and we try to support both versions. - _temp = self.queryset.order_by(lookup) + _temp = self.queryset.order_by(lookup).query if hasattr(_temp, 'as_sql'): - _temp.query.as_sql() + _temp.as_sql() else: from django.db import DEFAULT_DB_ALIAS - _temp.query.get_compiler(DEFAULT_DB_ALIAS).as_sql() + _temp.get_compiler(DEFAULT_DB_ALIAS).as_sql() break except FieldError: pass -- 2.26.2