示例#1
0
from filer.models import Image as FilerImage
from filer.models import File as FilerFile
from minitrue.base import replacer

replacer.register(FilerImage, fields=['default_alt_text', 'default_caption', 'description'])
replacer.register(FilerFile, fields=['description'],)
from django.conf import settings

from cms.models import Title

from minitrue.base import replacer
from minitrue.contrib.django_cms.utils import plugin_get_url

def title_get_url(obj):
    return obj.page.get_absolute_url()

replacer.register(Title, fields=['title', 'page_title', 'menu_title', 'redirect', 'meta_description', 'meta_keywords'],
    urlgetter=title_get_url, select_related=['page'])

if 'cms.plugins.text' in settings.INSTALLED_APPS:
    from cms.plugins.text.models import Text
    replacer.register(Text, fields=['body'], urlgetter=plugin_get_url,
        select_related=['placeholder__page'])

if 'cms.plugins.snippet' in settings.INSTALLED_APPS:
    from cms.plugins.snippet.models import Snippet
    replacer.register(Snippet, fields=['html'], select_related=['placeholder__page'])

if 'cms.plugins.file' in settings.INSTALLED_APPS:
    from cms.plugins.file.models import File
    replacer.register(File, fields=['title'],
        urlgetter=plugin_get_url,
        select_related=['placeholder__page'],
    )

if 'cms.plugins.link' in settings.INSTALLED_APPS:
    from cms.plugins.link.models import Link
示例#3
0
from django.conf import settings

from cms.models import Title

from minitrue.base import replacer
from minitrue.contrib.django_cms.utils import plugin_get_url


def title_get_url(obj):
    return obj.page.get_absolute_url()


replacer.register(Title,
                  fields=[
                      'title', 'page_title', 'menu_title', 'redirect',
                      'meta_description', 'meta_keywords'
                  ],
                  urlgetter=title_get_url,
                  select_related=['page'])

if 'cms.plugins.text' in settings.INSTALLED_APPS:
    from cms.plugins.text.models import Text
    replacer.register(Text,
                      fields=['body'],
                      urlgetter=plugin_get_url,
                      select_related=['placeholder__page'])

if 'cms.plugins.snippet' in settings.INSTALLED_APPS:
    from cms.plugins.snippet.models import Snippet
    replacer.register(Snippet,
                      fields=['html'],
示例#4
0
from cms.models.titlemodels import Title
from minitrue.base import replacer

replacer.register(Title, fields=['title', 'redirect'])
from simplegallery.models import (Gallery, Image as GalleryImage, CarouselImage,
                                  CarouselFeature)

from minitrue.base import replacer

from minitrue.contrib.django_cms.utils import plugin_get_url

replacer.register(Gallery, fields=['name', 'title', 'description'], urlgetter=plugin_get_url,
    select_related=['placeholder__page'])
replacer.register(GalleryImage, fields=['title', 'description'])
replacer.register(CarouselImage, fields=['title', 'description', 'url'])
replacer.register(CarouselFeature, fields=['title'], urlgetter=plugin_get_url,
    select_related=['placeholder__page'])
from simplegallery.models import (Gallery, Image as GalleryImage,
                                  CarouselImage, CarouselFeature)

from minitrue.base import replacer

from minitrue.contrib.django_cms.utils import plugin_get_url

replacer.register(Gallery,
                  fields=['name', 'title', 'description'],
                  urlgetter=plugin_get_url,
                  select_related=['placeholder__page'])
replacer.register(GalleryImage, fields=['title', 'description'])
replacer.register(CarouselImage, fields=['title', 'description', 'url'])
replacer.register(CarouselFeature,
                  fields=['title'],
                  urlgetter=plugin_get_url,
                  select_related=['placeholder__page'])