# Path: src/slim/helpers.py
# def get_default_language():
# def get_languages():
# def get_languages_keys():
# def get_languages_dict():
# def get_language_from_request(request, default=default_language):
# def admin_change_url(app_label, module_name, object_id, extra_path='',
#                      url_title=None):
# def admin_add_url(app_label, module_name, extra_path='', url_title=None):
# def smart_resolve(var, context):
# 
# Path: src/slim/monkey_patches.py
# def monkeypatch_method(cls):
#     """
#     A decorator to add a single method to an existing class::
# 
#         @monkeypatch_method(<someclass>)
#         def <newmethod>(self, [...]):
#             pass
#     """
#     def decorator(func):
#         setattr(cls, func.__name__, func)
#         return func
#     return decorator
# 
# def monkeypatch_property(cls):
#     """
#     A decorator to add a single method as a property to an existing class::
# 
#         @monkeypatch_property(<someclass>)
#         def <newmethod>(self, [...]):
#             pass
#     """
#     def decorator(func):
#         setattr(cls, func.__name__, property(func))
#         return func
#     return decorator
# 
# Path: src/slim/settings.py
# ENABLE_MONKEY_PATCHING = get_setting('ENABLE_MONKEY_PATCHING')
# 
# Path: src/slim/translations.py
# def is_primary_language(language=None):
#     """Return true if current or passed language is the primary language.
# 
#     Return true if current or passed language is the primary language for the
#     site (the primary language is defined as the first language in
#     settings.LANGUAGES).
# 
#     :param str language:
#     :return bool:
#     """
#     if not language:
#         language = translation.get_language()
# 
#     return language == default_language


from six import PY3, text_type
from django.db import models
from django.core import exceptions
from django.utils.translation import ugettext_lazy as _
from nine import versions
from ..helpers import (
    get_languages,
    default_language,
    get_languages_keys,
    admin_change_url,
    admin_add_url
)
from ..monkey_patches import monkeypatch_method, monkeypatch_property
from ..settings import ENABLE_MONKEY_PATCHING
from ..translations import is_primary_language
    from south.modelsinspector import add_introspection_rules
                return True

            @monkeypatch_method(cls)
            def available_translations(self):
                """Return available translations.

                :return interable: At this moment a list of objects.
                """
                # New, unsaved pages have no translations
                if not self.id:
                    return []

                if is_primary_language(self.language):
                    return self.translations.all()
                elif self.translation_of:
                    return [self.translation_of] + \
                           list(
                                self.translation_of.translations.exclude(
                                    language=self.language
                                )
                           )
                else:
                    return []

            @monkeypatch_method(cls)
            def get_original_translation(self, *args, **kwargs):
                """Get original translation of current object.

                :return obj: Object of the same class as the one queried.
                """

# Path: src/slim/helpers.py
# def get_default_language():
# def get_languages():
# def get_languages_keys():
# def get_languages_dict():
# def get_language_from_request(request, default=default_language):
# def admin_change_url(app_label, module_name, object_id, extra_path='',
#                      url_title=None):
# def admin_add_url(app_label, module_name, extra_path='', url_title=None):
# def smart_resolve(var, context):
# 
# Path: src/slim/monkey_patches.py
# def monkeypatch_method(cls):
#     """
#     A decorator to add a single method to an existing class::
# 
#         @monkeypatch_method(<someclass>)
#         def <newmethod>(self, [...]):
#             pass
#     """
#     def decorator(func):
#         setattr(cls, func.__name__, func)
#         return func
#     return decorator
# 
# def monkeypatch_property(cls):
#     """
#     A decorator to add a single method as a property to an existing class::
# 
#         @monkeypatch_property(<someclass>)
#         def <newmethod>(self, [...]):
#             pass
#     """
#     def decorator(func):
#         setattr(cls, func.__name__, property(func))
#         return func
#     return decorator
# 
# Path: src/slim/settings.py
# ENABLE_MONKEY_PATCHING = get_setting('ENABLE_MONKEY_PATCHING')
# 
# Path: src/slim/translations.py
# def is_primary_language(language=None):
#     """Return true if current or passed language is the primary language.
# 
#     Return true if current or passed language is the primary language for the
#     site (the primary language is defined as the first language in
#     settings.LANGUAGES).
# 
#     :param str language:
#     :return bool:
#     """
#     if not language:
#         language = translation.get_language()
# 
#     return language == default_language


# Path: src/slim/models/fields.py
from six import PY3, text_type
from django.db import models
from django.core import exceptions
from django.utils.translation import ugettext_lazy as _
from nine import versions
from ..helpers import (
    get_languages,
    default_language,
    get_languages_keys,
    admin_change_url,
    admin_add_url
)
from ..monkey_patches import monkeypatch_method, monkeypatch_property
from ..settings import ENABLE_MONKEY_PATCHING
from ..translations import is_primary_language
    from south.modelsinspector import add_introspection_rules

                return True

            @monkeypatch_method(cls)
            def available_translations(self):
                """Return available translations.

                :return interable: At this moment a list of objects.
                """
                # New, unsaved pages have no translations
                if not self.id:
                    return []

                if is_primary_language(self.language):
                    return self.translations.all()
                elif self.translation_of:
                    return [self.translation_of] + \
                           list(
                                self.translation_of.translations.exclude(
                                    language=self.language
                                )
                           )
                else:
                    return []

            @monkeypatch_method(cls)
            def get_original_translation(self, *args, **kwargs):
                """Get original translation of current object.

                :return obj: Object of the same class as the one queried.
                """

                if is_primary_language(self.language):