django-html5-appcache will automatically include your application urls in the manifest file the if you have a sitemap-enabled application; however, to enable cache invalidation, is strongly advised to explicitly enable appcache support in your application.
For basic appcache support, you must create a appcache.py in your application directory (along models.py file), write an AppCache class and register it:
from html5_appcache import appcache_registry
from html5_appcache.appcache_base import BaseAppCache
from .models import MyModel, AnotherModel
class MyModelAppCache(BaseAppCache):
models = (MyModel, AnotherModel)
def signal_connector(self, instance, **kwargs):
self.manager.reset_manifest()
appcache_registry.register(MyModelAppCache())
This code declare support for MyModel and AnotherModel and hooks MyModelAppCache.signal_connector with post_save and post_delete signals.
Anytime you save or delete an instance of MyModel and AnotherModel cache will be marked as dirty.
If you don’t have a sitemap or you just want to customize the urls in the manifest file, you can add methods to the basic AppCache class above:
class MyModelAppCache(BaseAppCache):
...
def _get_urls(self, request):
...
return urls
def _get_assets(self, request):
...
return urls
def _get_network(self, request):
...
return urls
def _get_fallback(self, request):
...
return urls
request object is passed for convenience
See django CMS plugins.