#16737: inspectdb does not handle non-ascii column names correctly
------------------------------------+---------------------------------
Reporter: moof@… | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: ORM aggregation
Version: 1.3 | Severity: Normal
Resolution: | Keywords: inspectdb
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------+---------------------------------
Changes (by aaugustin):
* keywords: => inspectdb
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Comment:
Non-ASCII identifiers are only supported by Python 3, so we'll have to
convert the column name to ASCII.
To fix this, we have to:
- make sure `inspectdb` writes the file in utf-8
- add `# coding: utf-8` at the top of the file
- convert the column name to an ASCII field name, for instance with:
`unicodedata.normalize('NFKD', column_name).encode('ascii', 'ignore')`
- set `db_column` on the field
--
Ticket URL: <https://code.djangoproject.com/ticket/16737#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.