Example #1
0
def pjax_available(template_names, request):
    try: 
        from easy_pjax.templatetags.pjax_tags import pjax
    except ImportError:
        template_name = template_names.split(",",1)[0]
        return template_name.strip()
    else: 
        return pjax(template_names, request)
Example #2
0
    def test_template_choice_filter_with_flag(self):
        from easy_pjax.templatetags.pjax_tags import pjax

        assert pjax("base.html", True) == "pjax_base.html"
        assert pjax("base.html", False) == "base.html"
Example #3
0
    def test_template_choice_filter_with_template_params(self):
        from easy_pjax.templatetags.pjax_tags import pjax

        assert pjax("base.html,other_pjax.html", self.build_pjax_request()) == "other_pjax.html"
        assert pjax("base.html", self.build_regular_request()) == "base.html"
Example #4
0
    def test_template_choice_filter_with_flag(self):
        from easy_pjax.templatetags.pjax_tags import pjax

        assert pjax("base.html", True) == "pjax_base.html"
        assert pjax("base.html", False) == "base.html"
Example #5
0
    def test_template_choice_filter_with_template_params(self):
        from easy_pjax.templatetags.pjax_tags import pjax

        assert pjax("base.html,other_pjax.html",
                    self.build_pjax_request()) == "other_pjax.html"
        assert pjax("base.html", self.build_regular_request()) == "base.html"