Example #1
0
def register_content_model(model_class, model_fields, register_file):
    model_class.register_templates(*FEINCMS_TEMPLATES['default'])

    ModelRestructuredContent = model_class.create_content_type(RestructuredContent, class_name='RestructuredContent')
    model_class.create_content_type(ImageContent, class_name='ImageContent')
    if register_file: model_class.create_content_type(FileContent, class_name='FileContent')

    register_model(model_class, model_fields)

    class ModelRestructuredContentTranslationOptions(TranslationOptions):
        fields = 'text',

    translator.register(ModelRestructuredContent, ModelRestructuredContentTranslationOptions)
Example #2
0
def register_content_model(model_class, model_fields, translate=False, register_text=True, register_html=False):
    model_class.register_regions(('main', _("Main content area")),)
    ModelRestructuredContent = model_class.create_content_type(RestructuredContent, class_name=model_class.__name__ + 'Text') if register_text else None
    ModelHtmlContent = model_class.create_content_type(HtmlContent, class_name=model_class.__name__ + 'Html') if register_html else None
    ModelImageContent = model_class.create_content_type(ImageContent, class_name=model_class.__name__ + 'Image')

    if translate:
        register_model(model_class, model_fields)

        ModelRestructuredContent.feincms_item_editor_inline = TranslatedFeinCMSInline
        ModelHtmlContent.feincms_item_editor_inline = TranslatedFeinCMSInline
        ModelImageContent.feincms_item_editor_inline = TranslatedFeinCMSInline

        if register_text:
            class ModelRestructuredContentTranslationOptions(TranslationOptions):
                fields = 'text',

            translator.register(ModelRestructuredContent, ModelRestructuredContentTranslationOptions)

        if register_html:
            class ModelHtmlContentTranslationOptions(TranslationOptions):
                fields = 'text',

            translator.register(ModelHtmlContent, ModelHtmlContentTranslationOptions)

        class ModelImageContentTranslationOptions(TranslationOptions):
            fields = 'caption',

        translator.register(ModelImageContent, ModelImageContentTranslationOptions)
Example #3
0
def register_content_model(model_class, model_fields=('title', 'text'), register_text=True, register_html=False):
    model_class.register_regions(('main', _("Main content area")),)
    ModelRestructuredContent = model_class.create_content_type(RestructuredContent, class_name=model_class.__name__ + 'Text') if register_text else None
    ModelHtmlContent = model_class.create_content_type(HtmlContent, class_name=model_class.__name__ + 'Html') if register_html else None
    ModelImageContent = model_class.create_content_type(ImageContent, class_name=model_class.__name__ + 'Image')

    register_model(model_class, model_fields)

    if register_text:
        class ModelRestructuredContentTranslationOptions(TranslationOptions):
            fields = 'text',

        translator.register(ModelRestructuredContent, ModelRestructuredContentTranslationOptions)

    if register_html:
        class ModelHtmlContentTranslationOptions(TranslationOptions):
            fields = 'text',

        translator.register(ModelHtmlContent, ModelHtmlContentTranslationOptions)

    class ModelImageContentTranslationOptions(TranslationOptions):
        fields = 'caption',

    translator.register(ModelImageContent, ModelImageContentTranslationOptions)
Example #4
0
from modeltranslation.translator import translator
from modeltranslation.translator import TranslationOptions


from .models import Block
from .models import SubBlock


class BlockTranslationOptions(TranslationOptions):
	fields = ['title', 'sub_title', 'text']

translator.register(Block, BlockTranslationOptions)


class SubBlockTranslationOptions(TranslationOptions):
	fields = ['title', 'sub_title', 'description']

translator.register(SubBlock, SubBlockTranslationOptions)
Example #5
0
"""
Translation registration for django modeltranslation
"""

from modeltranslation.translator import translator, TranslationOptions

from orb.toolkits import models


class ToolkitTranslation(TranslationOptions):
    fields = ('title', 'description')


translator.register(models.Toolkit, ToolkitTranslation)
from modeltranslation.translator import translator, TranslationOptions
from seoutils.models import Meta

class MetaTranslationOptions(TranslationOptions):
    fields = ('title', 'keywords', 'desc')
translator.register(Meta, MetaTranslationOptions)
# -*- coding: utf-8 -*-

from modeltranslation.translator import translator, TranslationOptions
from .models import Categories, FlatPage
#from seoutils.models import Meta

class FlatPageTranslationOptions(TranslationOptions):
    fields = ('title', 'content', 'description', 'meta_description', 'meta_keywords', )


class CategoriesTranslationOptions(TranslationOptions):
    fields = ('name', )


translator.register(FlatPage, FlatPageTranslationOptions)
translator.register(Categories, CategoriesTranslationOptions)

Example #8
0
from modeltranslation.translator import translator, TranslationOptions
from flatblocks.models import FlatBlock
from geonode.maps.models import Layer


class FlatBlockTO(TranslationOptions):
    fields = ('content',)


class LayerTO(TranslationOptions):
    fields = (
             'title',
             'edition',
             'abstract',
             'purpose',
             'constraints_other',
             'distribution_description',
             'data_quality_statement',
             'supplemental_information',
             )


translator.register(FlatBlock, FlatBlockTO)
#translator.register(Layer, LayerTO)
Example #9
0
from modeltranslation.translator import translator, TranslationOptions
from openbudget.apps.pages.models import Page


class PageTransOps(TranslationOptions):
    fields = ('title', 'content')


translator.register(Page, PageTransOps)
Example #10
0
from modeltranslation.translator import translator, TranslationOptions

from .models import Gift, GiftSet


class GiftTranslationOptions(TranslationOptions):
    fields = ('name', )
    required_languages = {'default': ('name', )}


translator.register(Gift, GiftTranslationOptions)


class GiftSetTranslationOptions(TranslationOptions):
    fields = ('name', )
    required_languages = {'default': ('name', )}


translator.register(GiftSet, GiftSetTranslationOptions)
Example #11
0
from modeltranslation.translator import translator, TranslationOptions
from .models import Car


class CarTranslationOptions(TranslationOptions):
    fields = ('name', )


translator.register(Car, CarTranslationOptions)
Example #12
0
from .models import Portfolio, Menu, Contact, Website_Settings


class PortfolioTranslation(TranslationOptions):
    fields = (
        'title',
        'description',
    )


class MenuTranslation(TranslationOptions):
    fields = ('title',)


class ContactTranslation(TranslationOptions):
    fields = ('content',)


class WebsiteSettingsTranslation(TranslationOptions):
    fields = (
        'about_app_content',
        'about_me_content',
        'full_name',
    )


translator.register(Portfolio, PortfolioTranslation)
translator.register(Menu, MenuTranslation)
translator.register(Contact, ContactTranslation)
translator.register(Website_Settings, WebsiteSettingsTranslation)
Example #13
0
from modeltranslation.translator import translator, TranslationOptions
from cms.models import CMSPlugin


class CMSPluginTO(TranslationOptions):
    fields = ()


translator.register(CMSPlugin, CMSPluginTO)
Example #14
0
from modeltranslation.translator import translator, TranslationOptions

from tournament.models import Tournament


class TournamentTranslationOptions(TranslationOptions):
    fields = ['name', 'registration_description', 'results_description']


translator.register(Tournament, TournamentTranslationOptions)
from modeltranslation.translator import translator, TranslationOptions
from .models import HobbyCategory, HobbyAudience


class HobbyCategoryTranslationOptions(TranslationOptions):
    fields = ('name', )


class HobbyAudienceTranslationOptions(TranslationOptions):
    fields = ('name', )


translator.register(HobbyCategory, HobbyCategoryTranslationOptions)
translator.register(HobbyAudience, HobbyAudienceTranslationOptions)
# -*- coding: utf-8 -*-
from .models import Testimonial
from modeltranslation.translator import translator, TranslationOptions


class TestimonialTranslationOptions(TranslationOptions):
    fields = ('testimonial', )


translator.register(Testimonial, TestimonialTranslationOptions)
Example #17
0
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################

from modeltranslation.translator import translator, TranslationOptions
from geonode.maps.models import Map, MapStory


class MapTranslationOptions(TranslationOptions):
    fields = (
        'title',
        'abstract',
        'purpose',
        'constraints_other',
        'supplemental_information',
        'data_quality_statement',
    )


translator.register(Map, MapTranslationOptions)
translator.register(MapStory)
Example #18
0
from modeltranslation.translator import translator, TranslationOptions

from apps.tasks.models import Category, Task


class CategoryTranslationOptions(TranslationOptions):
    fields = ('name', )
    required_languages = ('en', )


class TaskTranslationOptions(TranslationOptions):
    fields = ('name', )
    required_languages = ('en', )


translator.register(Category, CategoryTranslationOptions)
translator.register(Task, TaskTranslationOptions)
Example #19
0
from modeltranslation.translator import translator, TranslationOptions
from homepage.models import Section

class SectionTranslationOptions(TranslationOptions):
    fields = ('name', 'description',)

translator.register(Section, SectionTranslationOptions)
from modeltranslation.translator import translator, TranslationOptions
from .models import Listing


class ListingTranslationOptions(TranslationOptions):
    fields = ('title', 'description')


translator.register(Listing, ListingTranslationOptions)
Example #21
0
# -*- coding: utf-8 -*-
from modeltranslation.translator import translator, TranslationOptions

from exams.models import Subject, MaterialType, SubjectGroup, SpecialArrangement

class SubjectTranslationOptions(TranslationOptions):
    fields = ('name',)
translator.register(Subject, SubjectTranslationOptions)

class SubjectGroupTranslationOptions(TranslationOptions):
    fields = ('name',)
translator.register(SubjectGroup, SubjectGroupTranslationOptions)

class MaterialTypeTranslationOptions(TranslationOptions):
    fields = ('title',)
translator.register(MaterialType, MaterialTypeTranslationOptions)

class SpecialArrangementTranslationOptions(TranslationOptions):
    fields = ('title',)
translator.register(SpecialArrangement, SpecialArrangementTranslationOptions)
Example #22
0
from django.db import models
from mezzanine.pages.models import Page
from modeltranslation.translator import translator, TranslationOptions
from .models import Author, Book
from modeltranslation.translator import translator
from mezzanine.core.translation import (TranslatedSlugged,
                                        TranslatedDisplayable,
                                        TranslatedRichText)
from mezzanine.blog.models import BlogCategory, BlogPost



class TranslatedBlogPost(TranslatedDisplayable, TranslatedRichText):
    fields = ('title', 'description', 'gen_description')

class TranslatedBlogBlogCategory(TranslatedSlugged):
    fields = ()

translator.register(BlogPost, TranslatedBlogPost)
translator.register(BlogCategory, TranslatedBlogBlogCategory)
Example #23
0
# coding: utf-8
from modeltranslation.translator import translator, TranslationOptions
from models import URLLink


class URLLinkTranslationOptions(TranslationOptions):
    fields = ('title', 'description',)

translator.register(URLLink, URLLinkTranslationOptions)
Example #24
0
from modeltranslation.translator import translator, TranslationOptions
from models import TransportationsGeography


class TransportationsTranslationOptions(TranslationOptions):
    fields = ('description', 'title')


translator.register(TransportationsGeography,
                    TransportationsTranslationOptions)
Example #25
0
# -*- coding: utf-8 -*-

from modeltranslation.translator import translator, TranslationOptions
from . import models


class ChunkOpts(TranslationOptions):
    fields = ('content', )


class ChunkGroupOpts(TranslationOptions):
    fields = ('content', )


class ChunkMediaOpts(TranslationOptions):
    fields = ('title', 'desc', 'media', )


translator.register(models.Media, ChunkMediaOpts)
translator.register(models.Group, ChunkGroupOpts)
translator.register(models.Chunk, ChunkOpts)
Example #26
0
    objects = SettingManager()

    class Meta:
        verbose_name = _("setting")
        verbose_name_plural = _("settings")


class SettingTranslationOptions(TranslationOptions):
    """
    Translation options class for modeltranslation application.
    You should list fields for Setting module which need to be translated in the attribute `fields` of this class.
    """
    fields = ('site_name', 'bookmarklet_title')


translator.register(Setting, SettingTranslationOptions)


def update_cache(**kwargs):
    """
    Updates the cached settings information. Since the settings might be different to each language,
    we need to iterate over languages, activate the language, get translations for selected language, and update the data in cache.
    If kwargs['language'] is passed, settings for that language are returned.
    """

    for language in settings.LANGUAGES:
        language = language[0]
        setting_values = Setting.objects.get_language_settings(language)
        cache.set('%s_%s' % (SITE_SETTINGS_CACHE_KEY, language),
                  setting_values, SITE_SETTINGS_CACHE_TIMEOUT)
from modeltranslation.translator import translator, TranslationOptions
from .models import MediaLibrary, MediaFile
from mezzanine.core.translation import TranslatedRichText

class TranslatedMediaLibrary(TranslatedRichText):
    field = ()

class TranslatedMediaFile(TranslationOptions):
    fields = ('description',)

translator.register(MediaLibrary, TranslatedMediaLibrary)
translator.register(MediaFile, TranslatedMediaFile)
Example #28
0
from modeltranslation.translator import TranslationOptions, translator

from rules.models import Ordinance, Rule


class OrdinanceTranslationOptions(TranslationOptions):
    fields = ("legal_description", )


class RuleTranslationOptions(TranslationOptions):
    fields = ("title", "plain_description")


translator.register(Rule, RuleTranslationOptions)
translator.register(Ordinance, OrdinanceTranslationOptions)
Example #29
0
from modeltranslation.translator import translator, TranslationOptions
from dashboard.models import Project as DashboardProject


#dashboard
class DashboardProjectTranslationOptions(TranslationOptions):
    fields = ('title',
              'description',
              )

translator.register(DashboardProject, DashboardProjectTranslationOptions)

from modeltranslation.translator import TranslationOptions, translator

from .models import ModeltranslationTreeItem


class TreeItemTranslationOptions(TranslationOptions):
    # These fields are for translation.
    fields = ('title', 'hint', 'description', 'url')


translator.register(ModeltranslationTreeItem, TreeItemTranslationOptions)
Example #31
0
from modeltranslation.translator import translator, TranslationOptions
from survey.models import Question, Target


class QuestionTranslationOptions(TranslationOptions):
    fields = ('name', 'ask', 'analyze')


class TargetTranslationOptions(TranslationOptions):
    fields = ('name', )


translator.register(Question, QuestionTranslationOptions)
translator.register(Target, TargetTranslationOptions)
# You must run command below after adding aditional field to fields:
# python manage.py sync_translation_fields
# python manage.py makemigrations
# python manage.py migrate
    MetaData, Displayable, Page, RichText, RichTextPage, MultitableModelA,
    MultitableModelB, MultitableModelC, ManagerTestModel,
    CustomManagerTestModel, CustomManager2TestModel, GroupFieldsetsModel,
    NameModel, ThirdPartyRegisteredModel, ProxyTestModel, UniqueNullableModel)


class TestTranslationOptions(TranslationOptions):
    fields = (
        'title',
        'text',
        'url',
        'email',
    )


translator.register(TestModel, TestTranslationOptions)


class UniqueNullableTranslationOptions(TranslationOptions):
    fields = ('title', )


translator.register(UniqueNullableModel, UniqueNullableTranslationOptions)

########## Proxy model testing


class ProxyTestTranslationOptions(TranslationOptions):
    fields = (
        'title',
        'text',
Example #33
0
from modeltranslation.translator import translator, TranslationOptions

from paintings.models import Gallery, Painting


class GalleryTranslationOptions(TranslationOptions):
	fields = ('title',)
	required_languages = ('ru', 'en',)


class PaintingTranslationOptions(TranslationOptions):
	fields = ('title',)
	required_languages = ('ru', 'en',)


translator.register(Gallery, GalleryTranslationOptions)
translator.register(Painting, PaintingTranslationOptions)
Example #34
0
from modeltranslation.translator import translator, TranslationOptions
from core.models import WhatToDoSeason


class WhatToDoSeasonTranslationOptions(TranslationOptions):
    fields = (
        'headline',
        'copy',
    )


translator.register(WhatToDoSeason, WhatToDoSeasonTranslationOptions)
from modeltranslation.translator import translator, TranslationOptions
from contact_form.models import Subject


class SubjectTranslationOptions(TranslationOptions):
    fields = ('title', 'description')
    fallback_languages = {'default': ('en',)}

translator.register(Subject, SubjectTranslationOptions)
Example #36
0
from modeltranslation.translator import translator, TranslationOptions
from profile.models import Notification


class NotificationTranslationOptions(TranslationOptions):
    fields = ('text', )


translator.register(Notification, NotificationTranslationOptions)
Example #37
0
from __future__ import unicode_literals

from django.utils.translation import ugettext as _
from django.utils.translation import get_language as _get_language
from modeltranslation.translator import translator, TranslationOptions
from modeltranslation import utils
from nsms.text.models import Text


class TextTranslationOptions(TranslationOptions):
    fields = ('text',)

translator.register(Text, TextTranslationOptions)

# need to translate something for django translations to kick in
_("Something to trigger localizations")


# monkey patch a version of get_language that isn't broken
def get_language():
    lang = _get_language()
    return lang

utils.get_language = get_language
Example #38
0
from modeltranslation.translator import translator, TranslationOptions

from .models import KeynoteEvent


class KeynoteEventTranslationOptions(TranslationOptions):
    fields = ('speaker_name', 'speaker_bio', 'session_title', 'session_description')


translator.register(KeynoteEvent, KeynoteEventTranslationOptions)
Example #39
0
from cartridge.shop.models import (Category, Product, ProductOption,
                                   ProductImage, ProductVariation)


class TranslatedProduct(TranslatedDisplayable, TranslatedRichText):
    fields = ()


class TranslatedProductImage(TranslationOptions):
    fields = ('description',)


class TranslatedProductOption(TranslationOptions):
    fields = ('name',)


class TranslatedProductVariation(TranslationOptions):
    fields = tuple(('option%s' % opt[0] for opt in
                    settings.SHOP_OPTION_TYPE_CHOICES))


class TranslatedCategory(TranslatedRichText):
    fields = ()

translator.register(Product, TranslatedProduct)
translator.register(ProductImage, TranslatedProductImage)
translator.register(ProductOption, TranslatedProductOption)
translator.register(ProductVariation, TranslatedProductVariation)
translator.register(Category, TranslatedCategory)
Example #40
0
class ArticleTranslationOptions(TranslationOptions):
    fields = (
        'titre',
        'contenu',
    )


class MembreTranslationOptions(TranslationOptions):
    fields = (
        'description',
        'titre',
    )


class PaysTranslationOptions(TranslationOptions):
    fields = ('nom', )


class AmbassadeurTranslationOptions(TranslationOptions):
    fields = ('description', )


class NewsLetterTranslationOptions(TranslationOptions):
    fields = ('titre', 'contenu')


translator.register(Article, ArticleTranslationOptions)
translator.register(Membre, MembreTranslationOptions)
translator.register(Pays, PaysTranslationOptions)
translator.register(Ambassadeur, AmbassadeurTranslationOptions)
translator.register(NewsLetter, NewsLetterTranslationOptions)
Example #41
0
from modeltranslation.translator import translator, TranslationOptions
from models import Service


class ServiceTranslationOptions(TranslationOptions):
    fields = ('description',)

translator.register(Service, ServiceTranslationOptions)
Example #42
0
from modeltranslation.translator import translator, TranslationOptions
from anim_site_main.models import Single_Page


class Single_Page_TranslationOptions(TranslationOptions):
    fields = ('title', 'content')


translator.register(Single_Page, Single_Page_TranslationOptions)
# -*- coding: utf-8 -*-

from modeltranslation.translator import translator, TranslationOptions
from django_generic_flatblocks.contrib.gblocks.models import *


class TitleOptions(TranslationOptions):
    fields = ('title',)
translator.register(Title, TitleOptions)


class TextOptions(TranslationOptions):
    fields = ('text',)
translator.register(Text, TextOptions)


class ImageAndLinkOptions(TranslationOptions):
    fields = ('link', 'image')
translator.register(ImageAndLink, ImageAndLinkOptions)


class TitleAndFileOptions(TranslationOptions):
    fields = ('title', 'image')
translator.register(TitleAndFile, TitleAndFileOptions)


class TitleTextAndFileOptions(TranslationOptions):
    fields = ('title', 'text', 'file')
translator.register(TitleTextAndFile, TitleTextAndFileOptions)

from modeltranslation.translator import translator, TranslationOptions

from sms_templates.models import SMSTemplate


class SMSTemplateTranslationOptions(TranslationOptions):
    fields = ['text']


translator.register(SMSTemplate, SMSTemplateTranslationOptions)
Example #45
0
class ConcertTranslationOptions(TranslationOptions):
    fields = ('name', 'location')


class RepertoryTranslationOptions(TranslationOptions):
    fields = ('composer', 'lyrics', 'title')


class AboutUsTextBlockTranslationOptions(TranslationOptions):
    fields = ('title', 'content')

class ManagementTranslationOptions(TranslationOptions):
    fields = ('job',)


class ContactTextBlockTranslationOptions(TranslationOptions):
    fields = ('title', 'content')


class AdditionalPageTranslationOptions(TranslationOptions):
    fields = ('title', 'content')


translator.register(CarouselSlide, CarouselSlideTranslationOptions)
translator.register(Concert, ConcertTranslationOptions)
translator.register(Repertory, RepertoryTranslationOptions)
translator.register(AboutUsTextBlock, AboutUsTextBlockTranslationOptions)
translator.register(Management, ManagementTranslationOptions)
translator.register(ContactTextBlock, ContactTextBlockTranslationOptions)
translator.register(AdditionalPage, AdditionalPageTranslationOptions)
Example #46
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################

from modeltranslation.translator import translator, TranslationOptions
from geonode.layers.models import Layer


class LayerTranslationOptions(TranslationOptions):
    fields = (
        'title',
        'abstract',
        'purpose',
        'constraints_other',
        'supplemental_information',
        'data_quality_statement',
    )


translator.register(Layer, LayerTranslationOptions)
Example #47
0
from modeltranslation.translator import translator, TranslationOptions
from page.models import *

class PageTranslationOptions(TranslationOptions):
	fields = ('content',)
	required_languages = ('en','zh-cn')

translator.register(Page,PageTranslationOptions)

Example #48
0
from modeltranslation.translator import translator, TranslationOptions
from shop.models import Product, Category


class ProductTranslationOptions(TranslationOptions):
    fields = (
        'name',
        'description',
    )


translator.register(Product, ProductTranslationOptions)


class CategoryTranslationOptions(TranslationOptions):
    fields = ('name', )


translator.register(Category, CategoryTranslationOptions)
Example #49
0

class TagTranslationOptions(TNMTranslationOptions):
    pass


class TechnologyTranslationOptions(TNMTranslationOptions):
    pass


class GroupTranslationOptions(TNMTranslationOptions):
    fields = ('description', 'short_name', )


class AreaMixinTranslationOptions(TNMTranslationOptions):
    fields = ('description', )


translator.register(TranslatableNameMixin, TNMTranslationOptions)
translator.register(Applicant, ApplicantTranslationOptions)
translator.register(ContactDetail, ContactDetailTranslationOptions)
translator.register(Description, DescriptionTranslationOptions)
translator.register(Project, ProjectTranslationOptions)
translator.register(ProjectImage, ProjectImageTranslationOptions)
translator.register(Attachment, AttachmentTranslationOptions)
translator.register(Tag, TagTranslationOptions)
translator.register(Technology, TagTranslationOptions)
translator.register(Group, GroupTranslationOptions)
translator.register(AreaOfInterest, AreaMixinTranslationOptions)
translator.register(AreaOfKnowledge, AreaMixinTranslationOptions)
Example #50
0
from modeltranslation.translator import translator, TranslationOptions

from ajapaik.ajapaik.models import Photo, Area, Album, Licence


class PhotoTranslationOptions(TranslationOptions):
    fields = (
        'title',
        'description',
    )


class AreaTranslationOptions(TranslationOptions):
    fields = ('name', )


class AlbumTranslationOptions(TranslationOptions):
    fields = ('name', )


class LicenceTranslationOptions(TranslationOptions):
    fields = ('name', )


translator.register(Photo, PhotoTranslationOptions)
translator.register(Area, AreaTranslationOptions)
translator.register(Album, AlbumTranslationOptions)
translator.register(Licence, LicenceTranslationOptions)
Example #51
0
class ItemTO(TranslationOptions):
    fields = 'name', 'description'


class NewsTO(TranslationOptions):
    fields = 'title', 'text'


class CategoryTO(TranslationOptions):
    fields = 'name', 'description'


class GroupTO(TranslationOptions):
    fields = 'name', 'description'


class SiteDescriptionTO(TranslationOptions):
    fields = ['description']


registry = (
        (Item, ItemTO),
        (News, NewsTO),
        (Category, CategoryTO),
        (Group, GroupTO),
        (SiteDescription, SiteDescriptionTO),
        )

for model, to in registry:
    translator.register(model, to)
Example #52
0
# -*- coding: utf-8 -*-
from .models import LinkCategory, UsefulLink
from modeltranslation.translator import translator, TranslationOptions


class UsefulLinkTranslationOptions(TranslationOptions):
    fields = ('label',)


class LinkCategoryTranslationOptions(TranslationOptions):
    fields = ('label',)


translator.register(LinkCategory, LinkCategoryTranslationOptions)
translator.register(UsefulLink, UsefulLinkTranslationOptions)
Example #53
0
from modeltranslation.translator import translator, TranslationOptions
from front.models import (Event, TipForCycling)
from django.contrib.flatpages.models import FlatPage


class EventTranslationOptions(TranslationOptions):
    fields = ['title', 'content', 'address', 'subscription_link', 'price']


translator.register(Event, EventTranslationOptions)


class FlatPageTranslationOptions(TranslationOptions):
    fields = ['title', 'content']


translator.register(FlatPage, FlatPageTranslationOptions)


class TipForCyclingTranslationOptions(TranslationOptions):
    fields = ['title', 'content']


translator.register(TipForCycling, TipForCyclingTranslationOptions)
Example #54
0
from modeltranslation.translator import translator, TranslationOptions
from .models import Bind, Code


class TranslateBind(TranslationOptions):
    fields = ()


class TranslateCode(TranslationOptions):
    fields = ()

translator.register(Code, TranslateCode)
translator.register(Bind, TranslateBind)
Example #55
0
# -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#

from modeltranslation.translator import translator, TranslationOptions
from infopages.models import InfoPage

class InfoPageTranslationOptions(TranslationOptions):
    fields = ('title', 'left_column', 'right_column')

translator.register(InfoPage, InfoPageTranslationOptions)
Example #56
0
# @License: Copyright (c) Foton IT, All Right Reserved

from modeltranslation.translator import register, translator, TranslationOptions

from .models import About, Item


class AboutTranslationOptions(TranslationOptions):
    fields = (
        'title',
        'slug',
        'intro',
    )
    required_languages = ('fr', )


translator.register(About, AboutTranslationOptions)


class ItemTranslationOptions(TranslationOptions):
    fields = (
        'about',
        'title',
        'slug',
        'description',
    )
    required_languages = ('fr', )


translator.register(Item, ItemTranslationOptions)
Example #57
0
from modeltranslation.translator import translator, TranslationOptions
from sitemusique.core.models import Generique,Professeurs,Cours

class GeneriqueTranslationOptions(TranslationOptions):
    fields = ('texteAcceuil','texteContact',)

translator.register(Generique, GeneriqueTranslationOptions)




class CoursTranslationOptions(TranslationOptions):
    fields = ('instrument',)

translator.register(Cours, CoursTranslationOptions)


Example #58
0
# class TranslationOptions(TranslationOptions):
# 	fields = ('nombre','','','','','','','','','','','','','','','','','','','','','','','','','','')

# class TranslationOptions(TranslationOptions):
# 	fields = ('nombre','','','','','','','','','','','','','','','','','','','','','','','','','','')

# class TranslationOptions(TranslationOptions):
# 	fields = ('nombre','','','','','','','','','','','','','','','','','','','','','','','','','','')

# class TranslationOptions(TranslationOptions):
# 	fields = ('nombre','','','','','','','','','','','','','','','','','','','','','','','','','','')

# class TranslationOptions(TranslationOptions):
# 	fields = ('nombre','','','','','','','','','','','','','','','','','','','','','','','','','','')

# class TranslationOptions(TranslationOptions):
# 	fields = ('nombre','','','','','','','','','','','','','','','','','','','','','','','','','','')

# Primera version
translator.register(TranslaterDicc, TranslaterDiccTranslationOptions)
translator.register(InfoSite, InfoSiteTranslationOptions)
translator.register(Sliders, SlidersTranslationOptions)
translator.register(PorqueElegirnos, PorqueElegirnosTranslationOptions)
translator.register(Conocenos, ConocenosTranslationOptions)
translator.register(EllosOpinan, EllosOpinanTranslationOptions)
translator.register(Paises, PaisesTranslationOptions)
translator.register(ContactoSeccion, ContactoSeccionTranslationOptions)
translator.register(LibroSeccion, LibroSeccionTranslationOptions)
translator.register(PaypalInfo, PaypalInfoTranslationOptions)
Example #59
0
from modeltranslation.translator import translator
from modeltranslation.translator import TranslationOptions

# from .models import TariffAddition
# from .models import Tariff


class TariffAdditionTranslationOptions(TranslationOptions):
	fields = ['name', 'description', 'price']

translator.register(TariffAddition, TariffAdditionTranslationOptions)


class TariffTranslationOptions(TranslationOptions):
	fields = ['title', 'sub_title', 'price_after', 'description', 'options']

translator.register(Tariff, TariffTranslationOptions)
Example #60
0
from modeltranslation.translator import translator, register, TranslationOptions
from mezzanine.core.translation import TranslatedSlugged, TranslatedDisplayable, TranslatedRichText
from news.models import ListNews, News


@register(ListNews)
class ListNewsTranslationOptions(TranslationOptions):
    fields = ('titre_general', )


# @register(News)
# class NewsTranslationOptions(TranslationOptions):
#     fields = ('news_description',)


class TranslatedNews(TranslatedDisplayable):
    fields = (
        'title',
        'news_description',
        'resume',
        'lieu',
        'public_cible',
    )


translator.register(News, TranslatedNews)