예제 #1
0
 def test_more_nested_uses_fallback_to_parents(self):
     tools.assert_equals([
         u'page/category/nested-category/second-nested-category/category.html',
         u'page/category/nested-category/category.html',
         u'page/category.html'
     ], get_templates('category.html',
                      category=self.category_nested_second))
예제 #2
0
 def test_more_nested_uses_fallback_to_parents(self):
     tools.assert_equals(
         [
             u"page/category/nested-category/second-nested-category/category.html",
             u"page/category/nested-category/category.html",
             u"page/category.html",
         ],
         get_templates("category.html", category=self.category_nested_second),
     )
예제 #3
0
파일: views.py 프로젝트: susansmart/ella
    def __get_templates(self, context):
        " Extract parameters for `get_templates` from the context. "
        kw = {}
        if "object" in context:
            o = context["object"]
            kw["slug"] = o.slug

        if context.get("content_type", False):
            ct = context["content_type"]
            kw["app_label"] = ct.app_label
            kw["model_label"] = ct.model

        return get_templates(self.template_name, category=context["category"], **kw)
예제 #4
0
파일: test_views.py 프로젝트: jccode2/ella
 def test_first_nested_uses_only_path(self):
     tools.assert_equals(
         [u'page/category/nested-category/category.html', u'page/category.html'],
         get_templates('category.html', category=self.category_nested)
     )
예제 #5
0
파일: test_views.py 프로젝트: jccode2/ella
 def test_homepage_uses_only_path(self):
     tools.assert_equals(
         [u'page/category/ni-hao-category/category.html', u'page/category.html'],
         get_templates('category.html', category=self.category)
     )
예제 #6
0
 def test_first_nested_uses_only_path(self):
     tools.assert_equals(
         [u'page/category/nested-category/category.html', u'page/category.html'],
         get_templates('category.html', category=self.category_nested)
     )
예제 #7
0
 def test_homepage_uses_only_path(self):
     tools.assert_equals(
         [u'page/category/ni-hao-category/category.html', u'page/category.html'],
         get_templates('category.html', category=self.category)
     )
예제 #8
0
 def test_first_nested_uses_only_path(self):
     tools.assert_equals(
         [u"page/category/nested-category/category.html", u"page/category.html"],
         get_templates("category.html", category=self.category_nested),
     )
예제 #9
0
 def test_homepage_uses_only_path(self):
     tools.assert_equals(
         [u"page/category/ni-hao-category/category.html", u"page/category.html"],
         get_templates("category.html", category=self.category),
     )