from html5_appcache import appcache_registry
from html5_appcache.appcache_base import BaseAppCache


class CmsAppCache(BaseAppCache):
    """
    Appcache file form django CMS models
    """
    models = (Page, Title, File, Flash, GoogleMap, Link, Picture, Video,
              TwitterSearch, TwitterRecentEntries, InheritPagePlaceholder,
              Teaser)

    def signal_connector(self, instance, **kwargs):
        self.manager.reset_manifest()
appcache_registry.register(CmsAppCache())

try:
    # This will fail with django CMS 3.0+
    from cms.plugins.text.models import Text

    class CmsTextAppCache(BaseAppCache):
        models = (Text, )
        manager = None

        def signal_connector(self, instance, **kwargs):
            self.manager.reset_manifest()
    appcache_registry.register(CmsTextAppCache())
except ImportError:
    pass
示例#2
0
from html5_appcache.appcache_base import BaseAppCache


class CmsAppCache(BaseAppCache):
    """
    Appcache file form django CMS models
    """
    models = (Page, Title, File, Flash, GoogleMap, Link, Picture, Video,
              TwitterSearch, TwitterRecentEntries, InheritPagePlaceholder,
              Teaser)

    def signal_connector(self, instance, **kwargs):
        self.manager.reset_manifest()


appcache_registry.register(CmsAppCache())

try:
    # This will fail with django CMS 3.0+
    from cms.plugins.text.models import Text

    class CmsTextAppCache(BaseAppCache):
        models = (Text, )
        manager = None

        def signal_connector(self, instance, **kwargs):
            self.manager.reset_manifest()

    appcache_registry.register(CmsTextAppCache())
except ImportError:
    pass
示例#3
0
# -*- coding: utf-8 -*-
from filer.models import File, Image

from html5_appcache import appcache_registry
from html5_appcache.appcache_base import BaseAppCache


class FilerAppCache(BaseAppCache):
    """
    Appcache file form django-filer models
    """
    models = (File, Image)

    def signal_connector(self, instance, **kwargs):
        self.manager.reset_manifest()


appcache_registry.register(FilerAppCache())
示例#4
0
from html5_appcache import appcache_registry
from html5_appcache.appcache_base import BaseAppCache

from .models import News

class NewsAppCache(BaseAppCache):
    models = (News, )
    manager = None

    def _get_network(self, request):
        urls = []
        for item in News.objects.filter(published=True):
            urls.append(reverse('news_detail_live', kwargs={'pk': item.pk}))
        return urls

    def _get_urls(self, request):
        urls = [reverse('news_list')]
        for item in News.objects.filter(published=True):
            urls.append(reverse('news_detail', kwargs={'pk': item.pk}))
            # Adding this to later remove it in get_network
            urls.append(reverse('news_detail_live', kwargs={'pk': item.pk}))
        urls.append("http://www.example.com/fake-urlake")
        urls.append("https://www.example.com/fake-urlake")
        urls.append("ftp://www.example.com/fake-urlake")
        return urls

    def signal_connector(self, instance, **kwargs):
        self.manager.reset_manifest()

appcache_registry.register(NewsAppCache())
示例#5
0
# -*- coding: utf-8 -*-
from cmsplugin_filer_file.models import FilerFile
from cmsplugin_filer_image.models import FilerImage, ThumbnailOption
from cmsplugin_filer_folder.models import FilerFolder
from cmsplugin_filer_link.models import FilerLinkPlugin
from cmsplugin_filer_teaser.models import FilerTeaser
from cmsplugin_filer_video.models import FilerVideo

from html5_appcache import appcache_registry
from html5_appcache.appcache_base import BaseAppCache


class CmspluginFilerAppCache(BaseAppCache):
    """
    Appcache file form cmsplugin filer plugin models
    """
    models = (FilerFile, FilerImage, ThumbnailOption, FilerFolder,
              FilerLinkPlugin, FilerTeaser, FilerVideo)

    def signal_connector(self, instance, **kwargs):
        self.manager.reset_manifest()
appcache_registry.register(CmspluginFilerAppCache())
# -*- coding: utf-8 -*-
from filer.models import File, Image

from html5_appcache import appcache_registry
from html5_appcache.appcache_base import BaseAppCache


class FilerAppCache(BaseAppCache):
    """
    Appcache file form django-filer models
    """
    models = (File, Image)

    def signal_connector(self, instance, **kwargs):
        self.manager.reset_manifest()
appcache_registry.register(FilerAppCache())