Opened 17 years ago
Closed 17 years ago
#6574 closed (wontfix)
Make queries not select fields that has db_type None
Reported by: | oyvind | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | queryset-refactor |
Severity: | Keywords: | db_type query fields | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Since sql_model_create in django/core/management/sql.py does not create fields that has db_type None, queries should not try to select a non-existing field.
Would be solvable in qs-rf by this small change in
elif self.default_cols: table_alias = self.tables[0] result = ['%s.%s' % (qn(table_alias), qn(f.column)) for f in self.model._meta.fields] aliases = result[:]
Should be:
elif self.default_cols: table_alias = self.tables[0] result = ['%s.%s' % (qn(table_alias), qn(f.column)) for f in self.model._meta.fields if f.db_type()] aliases = result[:]
Attachments (1)
Change History (3)
by , 17 years ago
Attachment: | db_type_none.diff added |
---|
comment:1 by , 17 years ago
Has patch: | set |
---|---|
Needs documentation: | set |
Version: | SVN → queryset-refactor |
comment:2 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
No, this doesn't look right. Those fields can be created via a different mechanism (as they are in GeoDjango, for exmaple).
What is the problem you're actually trying to solve here. Note that intelligent column selection is still work in progress on queryset-refactor -- I haven't merged in some of Justin's suggested changes, for example -- so don't get too far ahead of the ballgame here, but a description of what you're trying to do might help guide future design work.
Perhaps open another ticket with a description of what currently doesn't work so that it doesn't get confused with this one.
Added patch with tests for queryset-refactor