0
我創建自定義模板標籤,其中有很多參數的:如何查找參數名Django的自定義模板標籤「的說法
@register.inclusion_tag('components/mail_button.html', takes_context=True)
def mail_button(context, button_content, button_name, button_link, button_width=265, button_height=47, background_color=COLOR_WHITE, margin_bottom=MARGIN_M):
return {
'button_content': button_content,
'button_name': button_name,
'button_link': button_link,
'button_width': button_width,
'button_height': button_height,
'background_color': background_color,
'margin_bottom': margin_bottom,
'site': context['site'],
'LANGUAGE_CODE': context['LANGUAGE_CODE']
}
然後在我的模板,我把我的自定義模板具有適當參數的標記。
{% mail_image 'mail-image-content-animated.jpg' 432 524 'Augmented Reality App' '#ECF0F1' %}
的問題是,當使用PyCharm,我怎麼可能查找參數名,無需導航到我的templatetags/mailing_tags.py((CMND/Ctrl +點擊)?
如果可以的話,我會很感激你的回答。保重!