我的 djangocms 页面模板顶部有这个
{% extends request.user.is_authenticated|yesno:"member_template.html,base.html" %}
我的插件无法使用此设置。但如果我这样做
{% extends "member_template.html" %}
我的插件可以工作。有办法解决这个问题吗?我想要那个条件。
最佳答案
假设您在 View 中使用渲染。
if request.user: base_file = "member_template.html"
else: base_file = base.html
render(request,'my_html.html',
{'base_file' : base_file})
然后你的扩展标签看起来像:
{% extends base_file %}
关于django - 我可以在条件扩展页面中使用 djangocms 插件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38546110/