Skip to main content
 首页 » 编程设计

python之在模板中指定 Django CMS 占位符类型(文本、图片、链接)

2025年05月04日7lvdongjie

是否可以限制占位符类型而不在 settings.py 中定义它?

类似于:{% placeholder "home_banner_title"image %}

请您参考如下方法:

不,你不能。如果你看at the source for the placeholder template tag您会看到只有 name、width、inherit 或 or 被处理。

因为 placeholder 模板标记在每次请求期间都会呈现,因此无论如何都不会在这里执行此操作,因此不会链接到 django 管理或可用占位符类型列表