예제 #1
0
def kolibri_set_urls(context):
    js_global_object_name = getattr(settings, 'JS_REVERSE_JS_GLOBAL_OBJECT_NAME', JS_GLOBAL_OBJECT_NAME)
    js_var_name = getattr(settings, 'JS_REVERSE_JS_VAR_NAME', JS_VAR_NAME)
    js = (js_reverse_inline(context) +
          "Object.assign({0}.urls, {1}.{2})".format(settings.KOLIBRI_CORE_JS_NAME,
                                                    js_global_object_name,
                                                    js_var_name))
    return mark_safe(js)
예제 #2
0
def kolibri_set_urls(context):
    js_global_object_name = getattr(settings,
                                    'JS_REVERSE_JS_GLOBAL_OBJECT_NAME',
                                    JS_GLOBAL_OBJECT_NAME)
    js_var_name = getattr(settings, 'JS_REVERSE_JS_VAR_NAME', JS_VAR_NAME)
    js = (
        js_reverse_inline(context) + "Object.assign({0}.urls, {1}.{2})".format(
            settings.KOLIBRI_CORE_JS_NAME, js_global_object_name, js_var_name))
    return mark_safe(js)
예제 #3
0
    def test_tpl_tag_without_request_in_contect(self):
        from django_js_reverse.templatetags.js_reverse import js_reverse_inline

        context_instance = RequestContext(None)
        Template("{%% load %s %%}{%% %s %%}" %
                 ('js_reverse', js_reverse_inline(context_instance)))
예제 #4
0
    def test_tpl_tag_without_request_in_contect(self):
        from django_js_reverse.templatetags.js_reverse import js_reverse_inline

        context_instance = RequestContext(None)
        Template("{%% load %s %%}{%% %s %%}" % ('js_reverse', js_reverse_inline(context_instance)))
    def test_tpl_tag_with_request_in_contect(self):
        from django_js_reverse.templatetags.js_reverse import js_reverse_inline

        context_instance = RequestContext(self.client.request)
        Template("{%% load %s %%}{%% %s %%}" %
                 ("js_reverse", js_reverse_inline(context_instance)))