mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-01 10:14:41 +00:00
Some python3 compatibility fixes (close #220).
This commit is contained in:
parent
b369b83745
commit
76da9bf92e
3 changed files with 3 additions and 7 deletions
|
|
@ -215,7 +215,7 @@ class TranslationBaseModelAdmin(BaseModelAdmin):
|
|||
if exclude_languages:
|
||||
excl_languages = exclude_languages
|
||||
exclude = []
|
||||
for orig_fieldname, translation_fields in self.trans_opts.fields.iteritems():
|
||||
for orig_fieldname, translation_fields in self.trans_opts.fields.items():
|
||||
for tfield in translation_fields:
|
||||
language = tfield.name.split('_')[-1]
|
||||
if language in excl_languages and tfield not in exclude:
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class Command(NoArgsCommand):
|
|||
db_table = model._meta.db_table
|
||||
model_full_name = '%s.%s' % (model._meta.app_label, model._meta.module_name)
|
||||
opts = translator.get_options_for_model(model)
|
||||
for field_name in opts.local_fields.iterkeys():
|
||||
for field_name in opts.local_fields.keys():
|
||||
missing_langs = list(self.get_missing_languages(field_name, db_table))
|
||||
if missing_langs:
|
||||
found_missing_fields = True
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
if sys.version > '3':
|
||||
long = int
|
||||
|
||||
from django.core import validators
|
||||
from django.db import models
|
||||
from django.utils import six
|
||||
|
|
@ -113,7 +109,7 @@ class FancyDescriptor(object):
|
|||
return 'a' * length
|
||||
|
||||
def __set__(self, obj, value):
|
||||
if isinstance(value, (int, long)):
|
||||
if isinstance(value, six.integer_types):
|
||||
obj.__dict__[self.field.name] = value
|
||||
elif isinstance(value, six.string_types):
|
||||
obj.__dict__[self.field.name] = len(value)
|
||||
|
|
|
|||
Loading…
Reference in a new issue