自定义 Longclaw ProductIndex 页面
Customizing Longclaw ProductIndex page
Longclaw/Wagtail 这里是新手。 Wagtail CMS 提供了一个可覆盖的 get_context 方法,可以将字典值传递到模板中。来自 documentation:
class BlogIndexPage(Page):
...
def get_context(self, request):
context = super(BlogIndexPage, self).get_context(request)
# Add extra variables and return the updated context
context['blog_entries'] = BlogPage.objects.child_of(self).live()
return context
Longclaw 是一个建立在 Wagtail 之上的电子商务项目。 Longclaw 有一个名为 ProductIndex 的内置页面模型。有什么方法可以将变量传递到 ProductIndex 模板中,就像我可以使用 get_context?
好问题。它目前不支持这一点,但如果可以的话就太好了。我建议在 GitHub 上提出问题,这样我们就无法将其投入开发 (https://github.com/JamesRamm/longclaw)
也许可以动态添加功能;
def get_context(...):
....
ProductIndex.get_context = get_context
我没有尝试过,所以不能肯定地说它会起作用!
Longclaw/Wagtail 这里是新手。 Wagtail CMS 提供了一个可覆盖的 get_context 方法,可以将字典值传递到模板中。来自 documentation:
class BlogIndexPage(Page):
...
def get_context(self, request):
context = super(BlogIndexPage, self).get_context(request)
# Add extra variables and return the updated context
context['blog_entries'] = BlogPage.objects.child_of(self).live()
return context
Longclaw 是一个建立在 Wagtail 之上的电子商务项目。 Longclaw 有一个名为 ProductIndex 的内置页面模型。有什么方法可以将变量传递到 ProductIndex 模板中,就像我可以使用 get_context?
好问题。它目前不支持这一点,但如果可以的话就太好了。我建议在 GitHub 上提出问题,这样我们就无法将其投入开发 (https://github.com/JamesRamm/longclaw)
也许可以动态添加功能;
def get_context(...):
....
ProductIndex.get_context = get_context
我没有尝试过,所以不能肯定地说它会起作用!