diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 7d95e1d..18a8248 100644
a
|
b
|
class Query(object):
|
390 | 390 | elif self.default_cols: |
391 | 391 | table_alias = self.tables[0] |
392 | 392 | result = ['%s.%s' % (qn(table_alias), qn(f.column)) |
393 | | for f in self.model._meta.fields] |
| 393 | for f in self.model._meta.fields if f.db_type()] |
394 | 394 | aliases = result[:] |
395 | 395 | |
396 | 396 | result.extend(['(%s) AS %s' % (col, alias) |
diff --git a/tests/modeltests/db_type/__init__.py b/tests/modeltests/db_type/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/modeltests/db_type/__init__.pyc b/tests/modeltests/db_type/__init__.pyc
new file mode 100644
index 0000000..d0cb950
Binary files /dev/null and b/tests/modeltests/db_type/__init__.pyc differ
diff --git a/tests/modeltests/db_type/models.py b/tests/modeltests/db_type/models.py
new file mode 100644
index 0000000..52d8bcb
-
|
+
|
|
| 1 | """ |
| 2 | This is a test for db_type None |
| 3 | """ |
| 4 | |
| 5 | from django.db import models |
| 6 | |
| 7 | class NoneCharField(models.CharField): |
| 8 | |
| 9 | def db_type(self): |
| 10 | return None |
| 11 | |
| 12 | class NoneTypeModel(models.Model): |
| 13 | |
| 14 | real_field = models.CharField(max_length=20) |
| 15 | fake_field = NoneCharField(max_length=20) |
| 16 | |
| 17 | def __unicode__(self): |
| 18 | return self.real_field |
| 19 | |
| 20 | __test__ = {'API_TESTS': """ |
| 21 | # test |
| 22 | >>> qs = NoneTypeModel.objects.all() |
| 23 | >>> str(qs.query.as_sql()).find('fake_field')==-1 |
| 24 | True |
| 25 | """} |