Пример #1
0
    def get_original_translation(self, *args, **kwargs):
        """
        Gets original translation of current object.

        :return obj: Object of the same class as the one queried.
        """
        if is_primary_language(self.language):
            return self
        return self.translation_of
Пример #2
0
    def get_original_translation(self, *args, **kwargs):
        """
        Gets original translation of current object.

        :return obj: Object of the same class as the one queried.
        """
        if is_primary_language(self.language):
            return self
        return self.translation_of
Пример #3
0
    def available_translations(self):
        """
        Returns available translations.

        :return interable: At this moment a list of objects.
        """
        if not self.id: # New, unsaved pages have no translations
            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 []
Пример #4
0
    def available_translations(self):
        """
        Returns available translations.

        :return interable: At this moment a list of objects.
        """
        if not self.id: # New, unsaved pages have no translations
            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 []