Table name did not get updated in test labels query. This makes it impossible to query against test labels.
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2014 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/new_tko/tko/models.py b/new_tko/tko/models.py
index 4bb9a59..277a45c 100644
--- a/new_tko/tko/models.py
+++ b/new_tko/tko/models.py
@@ -230,7 +230,7 @@
def get_query_set(self):
query = super(TestViewManager, self).get_query_set()
-
+
# add extra fields to selects, using the SQL itself as the "alias"
extra_select = dict((sql, sql)
for sql in self.model.extra_fields.iterkeys())
@@ -241,10 +241,11 @@
query_set = self.get_query_set()
# TODO: make this check more thorough if necessary
if 'test_labels' in filter_data.get('extra_where', ''):
+ table_name = self.model._meta.db_table
filter_object = self._JoinQ()
filter_object.add_join(
'test_labels_tests',
- 'test_labels_tests.test_id = test_view.test_idx',
+ 'test_labels_tests.test_id = %s.test_idx' % table_name,
'LEFT JOIN')
filter_object.add_join(
'test_labels',