Fixed #21090 - Allow backends to provide dotted field path to inspectdb. #1617

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

manfre commented Sep 11, 2013

No description provided.

django/core/management/commands/inspectdb.py
@@ -117,7 +117,10 @@ def handle_inspection(self, options):
if not field_type in ('TextField(', 'CharField('):
extra_params['null'] = True
- field_desc = '%s = models.%s' % (att_name, field_type)
+ if '.' in field_type:
@timgraham

timgraham Sep 11, 2013

Owner

stylistically, I'd prefer:

field_desc = '%s = %s%s' % (
    att_name,
    # comment explaining this
    '' if '.' in field_type else 'models.'
    field_type,
)

If we could add a test as discussed in IRC, that would be super.

Owner

timgraham commented Sep 11, 2013

merged in e61cc87 - thanks!

@timgraham timgraham closed this Sep 11, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment