更新时间:2023-11-30 16:05:28
如果您不覆盖插件的渲染方法(2.4及更高版本),则在您的上下文中将您的插件设为 instance
。使用以下内容,您将获得插件的基于1的位置:
if you don't override your plugins render method (2.4 and up), you'll have your plugin as instance
in your context. using the following, you'll get the 1 based position of your plugin:
{{instance.get_position_in_placeholder}}
也很有趣: is_first_in_placeholder
和 is_last_in_placeholder
。实际上,@ paulo已经在您的注释中向您显示了方向;)这是代码,并带有新的行号: https://github.com/divio/django-cms/blob/develop/cms/models/pluginmodel.py#L382
also interesting: is_first_in_placeholder
and is_last_in_placeholder
. in fact, @paulo already showed you the direction in his comment ;) this is the code, with new line number: https://github.com/divio/django-cms/blob/develop/cms/models/pluginmodel.py#L382