0
這是我以前的帖子。 Template includes and django views/urls. How (do/should) they work?。帶模板包含標籤的TemplateSyntaxError和SyntaxErrors
再次,迷你盒工作正常。我已經聽取了建議並試圖與之合作。
所以我有一個profile(request, profile_type, username)
視圖。我試圖從中獲取'profile_intros'context並將其放入包含的mini_profile.html模板中。
我試圖做一個包含標籤(我將整個網站的其他地方需要它):
@register.inclusion_tag('includes/profile_info.html', takes_context=True)(profile_info)
def profile_info(context):
profile_intros = FundRecommendation.objects.filter(investor=profile).count()
return{
'profile_intros' : context['profile_intros'],
}
和投擲{% profile_info %}
到包括mini_profile.html模板。我遵循了django doc示例,我真的不知道我做錯了什麼。
我越來越:
Exception Type: TemplateSyntaxError
Exception Value: Invalid block tag: 'profile_info'
我試過了,還在我安裝的應用程序中添加了'django.contrib.profile_info'。由於我的控制檯中有'Error:No module named profile_info',我無法啓動我的服務器或syndb。 :\ – Modelesq 2012-04-13 20:00:26
爲什麼你認爲「django.contrib.profile_info」是要添加的正確值? – 2012-04-13 20:02:36
例子。我是一個n00b(充其量),我只是想玩弄它。我所有的應用程序已經在那裏,我不太清楚還有什麼要補充說實話的。 – Modelesq 2012-04-13 20:07:08