示例#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
 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
 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),
     )