systemjs/templatetags/system_tags.py
def render(self, context):
        """
        Build the filepath by appending the extension.
        """
        module_path = self.path.resolve(context)
        if not settings.SYSTEMJS_ENABLED:
            if settings.SYSTEMJS_DEFAULT_JS_EXTENSIONS:
                name, ext = posixpath.splitext(module_path)
                if not ext:
                    module_path = '{}.js'.format(module_path)

            if settings.SYSTEMJS_SERVER_URL:
                tpl = """<script src="{url}{app}" type="text/javascript"></script>"""
            else:
                tpl = """<script type="text/javascript">System.import('{app}');</script>"""
            return tpl.format(app=module_path, url=settings.SYSTEMJS_SERVER_URL)

        # else: create a bundle
        rel_path = System.get_bundle_path(module_path)
        url = staticfiles_storage.url(rel_path)

        tag_attrs = {'type': 'text/javascript'}
        for key, value in self.tag_attrs.items():
            if not isinstance(value, bool):
                value = value.resolve(context)
            tag_attrs[key] = value

        return """<script{attrs} src="{url}"></script>""".format(
            url=url, attrs=flatatt(tag_attrs)
        )
def render(self, context):
        """
        Build the filepath by appending the extension.
        """
        module_path = self.path.resolve(context)
        if not settings.SYSTEMJS_ENABLED:
            if settings.SYSTEMJS_DEFAULT_JS_EXTENSIONS:
                name, ext = posixpath.splitext(module_path)
                if not ext:
                    module_path = '{}.js'.format(module_path)

            if settings.SYSTEMJS_SERVER_URL:
                tpl = """<script src="{url}{app}" type="text/javascript"></script>"""
            else:
                tpl = """<script type="text/javascript">System.import('{app}');</script>"""
            return tpl.format(app=module_path, url=settings.SYSTEMJS_SERVER_URL)

        # else: create a bundle
        rel_path = System.get_bundle_path(module_path)
        url = staticfiles_storage.url(rel_path)

        tag_attrs = {'type': 'text/javascript'}
        for key, value in self.tag_attrs.items():
            if not isinstance(value, bool):
                value = value.resolve(context)
            tag_attrs[key] = value

        return """<script{attrs} src="{url}"></script>""".format(
            url=url, attrs=flatatt(tag_attrs)
        )
def render ( self , context ) : module_path = self . path . resolve ( context ) if not settings . SYSTEMJS_ENABLED : if settings . SYSTEMJS_DEFAULT_JS_EXTENSIONS : name , ext = posixpath . splitext ( module_path ) if not ext : module_path = '{}.js' . format ( module_path ) if settings . SYSTEMJS_SERVER_URL : tpl = """<script src="{url}{app}" type="text/javascript"></script>""" else : tpl = """<script type="text/javascript">System.import('{app}');</script>""" return tpl . format ( app = module_path , url = settings . SYSTEMJS_SERVER_URL ) # else: create a bundle rel_path = System . get_bundle_path ( module_path ) url = staticfiles_storage . url ( rel_path ) tag_attrs = { 'type' : 'text/javascript' } for key , value in self . tag_attrs . items ( ) : if not isinstance ( value , bool ) : value = value . resolve ( context ) tag_attrs [ key ] = value return """<script{attrs} src="{url}"></script>""" . format ( url = url , attrs = flatatt ( tag_attrs ) )
Build the filepath by appending the extension.
Build the filepath by appending the extension .