def get_object(self, request, object_id, from_field=None):
        queryset = self.get_queryset(request)
        if isinstance(queryset, TranslationQueryset): # will always be true once Django 1.9 is required
            model = queryset.shared_model
            if from_field is None:
                field = model._meta.pk
            else:
                try:
                    field = model._meta.get_field(from_field)
                except FieldDoesNotExist:
                    field = model._meta.translations_model._meta.get_field(from_field)
        else:
            model = queryset.model
            field = model._meta.pk if from_field is None else model._meta.get_field(from_field)
        try:
            object_id = field.to_python(object_id)
            obj = queryset.get(**{field.name: object_id})
        except (model.DoesNotExist, ValidationError, __HOLE__):
            return None

        # object was in queryset - need to make sure we got the right translation
        # we use getattr to trigger a load if instance exists but translation was
        # not cached yet. Should not happen with current code, but is correct,
        # future-proof behavior.
        language_code = getattr(obj, 'language_code', None)
        request_lang = self._language(request)
        if language_code is None or language_code != request_lang:
            # if language does not match that of request, we know request_lang
            # does not exist, because it was the first language in the use_fallbacks
            # list. We prepare it as a new translation.
            obj.translate(request_lang)
        return obj
dataset/ETHPy150Open KristianOellegaard/django-hvad/hvad/admin.py/TranslatableAdmin.get_object