Skip to content

Commit

Permalink
Fixed deprecated meta api usage for Django 1.8, module_name was renam…
Browse files Browse the repository at this point in the history
…ed to model_name (ref #310).
  • Loading branch information
deschler committed May 6, 2015
1 parent 3a9fc92 commit 1f7ce84
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Credits: Heavily inspired by django-transmeta's sync_transmeta_db command.
"""
from optparse import make_option
import django
from django.core.management.base import NoArgsCommand
from django.core.management.color import no_style
from django.db import connection, transaction
Expand Down Expand Up @@ -67,7 +68,11 @@ def handle_noargs(self, **options):
models = translator.get_registered_models(abstract=False)
for model in models:
db_table = model._meta.db_table
model_full_name = '%s.%s' % (model._meta.app_label, model._meta.module_name)
if django.VERSION < (1, 8):
model_name = model._meta.module_name
else:
model_name = model._meta.model_name
model_full_name = '%s.%s' % (model._meta.app_label, model_name)
opts = translator.get_options_for_model(model)
for field_name, fields in opts.local_fields.items():
# Take `db_column` attribute into account
Expand Down

0 comments on commit 1f7ce84

Please sign in to comment.