big_blind_static.py 717 Bytes
Newer Older
Patrick's avatar
Patrick committed
1
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
2 3 4
from cms.utils.urlutils import static_with_version
import cms
__version__ = "/%s" % cms.__version__
Patrick's avatar
Patrick committed
5 6 7

class BigBlindManifestStaticFilesStorage(ManifestStaticFilesStorage):

8
    def url(self, context, force=True):
Patrick's avatar
Patrick committed
9 10 11
        """
        Override .url to use hashed url in development
        """
12 13 14 15 16 17
        try:
            return super(ManifestStaticFilesStorage, self).url(context, True)
        except ValueError:
            # Solve the reverted https://github.com/divio/django-cms/pull/5860/
            context = static_with_version(context)
            return super(ManifestStaticFilesStorage, self).url(context, True).replace(__version__, "")