2017-06-23 27 views
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 +點擊)?

如果可以的話,我會很感激你的回答。保重!

回答

0

好吧,這很簡單。爲了查找所有的custom-template-tag的參數名稱,你只需要懸停在自定義模板標籤上,按下ctrl/cmmnd,然後等待彈出窗口所有的細節都出現了。好一個!

相關問題