diff options
| author | JustinTArthur <justinarthur@gmail.com> | 2014-01-15 17:01:30 -0600 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-01-17 18:03:16 -0500 |
| commit | 298a2b577ffbe7f8ed00588694c792ac9adcefbe (patch) | |
| tree | 500bd36cbfc63259117c1d3d98484ec4dd39a481 /django | |
| parent | bc7668eb515b8ee7a32fbfb64dc4dff4d06abb5b (diff) | |
Adjusted inspectdb management command to yield PEP 8-compliant output barring Django Coding Style exceptions.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/inspectdb.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py index 0f291237f7..b9ff34d53d 100644 --- a/django/core/management/commands/inspectdb.py +++ b/django/core/management/commands/inspectdb.py @@ -50,12 +50,13 @@ class Command(NoArgsCommand): yield "from __future__ import unicode_literals" yield '' yield 'from %s import models' % self.db_module - yield '' known_models = [] for table_name in connection.introspection.table_names(cursor): if table_name_filter is not None and callable(table_name_filter): if not table_name_filter(table_name): continue + yield '' + yield '' yield 'class %s(models.Model):' % table2model(table_name) known_models.append(table2model(table_name)) try: @@ -134,7 +135,7 @@ class Command(NoArgsCommand): for k, v in extra_params.items()]) field_desc += ')' if comment_notes: - field_desc += ' # ' + ' '.join(comment_notes) + field_desc += ' # ' + ' '.join(comment_notes) yield ' %s' % field_desc for meta_line in self.get_meta(table_name): yield meta_line @@ -239,7 +240,7 @@ class Command(NoArgsCommand): to construct the inner Meta class for the model corresponding to the given database table name. """ - return [" class Meta:", + return ["", + " class Meta:", " managed = False", - " db_table = '%s'" % table_name, - ""] + " db_table = '%s'" % table_name] |
