Skip to content

Commit

Permalink
Import whole module to avoid cyclic import
Browse files Browse the repository at this point in the history
  • Loading branch information
shun-liang committed Mar 10, 2018
1 parent da47ae0 commit 09ffa1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions parler/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Meta:
is_missing,
)
from parler.fields import TranslatedField, LanguageCodeDescriptor, TranslatedFieldDescriptor
from parler.managers import TranslatableManager
from parler import managers
from parler.utils import compat
from parler.utils.i18n import (normalize_language_code, get_language, get_language_settings, get_language_title,
get_null_language_error)
Expand Down Expand Up @@ -896,7 +896,7 @@ class Meta:
abstract = True

# change the default manager to the translation manager
objects = TranslatableManager()
objects = managers.TranslatableManager()


class TranslatedFieldsModelBase(ModelBase):
Expand Down
7 changes: 4 additions & 3 deletions parler/utils/fields.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django.db.models.constants import LOOKUP_SEP
from django.db import models
from parler import models as parler_models

import django.db.models.fields


Expand All @@ -20,9 +22,8 @@ def get_model_from_relation(field):
def get_extra_related_translation_paths(model, path):
# type: (models.Model, str) -> List[str]
"""
Returns paths with active and default transalation models for all Translatable models in path
Returns paths with active and default translation models for all Translatable models in path
"""
from parler.models import TranslatableModel
pieces = path.split(LOOKUP_SEP)
parent = model
current_path = ''
Expand All @@ -31,7 +32,7 @@ def get_extra_related_translation_paths(model, path):
field = parent._meta.get_field(piece)
parent = get_model_from_relation(field)
current_path += LOOKUP_SEP + piece if current_path else piece
if issubclass(parent, TranslatableModel):
if issubclass(parent, parler_models.TranslatableModel):
for extension in parent._parler_meta:
extra_paths.append(current_path + LOOKUP_SEP + extension.rel_name_active)
extra_paths.append(current_path + LOOKUP_SEP + extension.rel_name_default)
Expand Down

0 comments on commit 09ffa1c

Please sign in to comment.