2012-02-18 63 views
0

我正在爲我的項目使用coleifer/Django-Relationships包。我一直在努力工作。Django Relationships- TemplateSyntaxerror

我在用戶個人資料模板中包含了模板'relationship_add.html',這樣當用戶找到另一個用戶時,如果兩個用戶都沒有關注對方,用戶就可以輕鬆點擊關注按鈕遵循對方。

包括用戶模板後型材模板:

{% include 'relationships/relationship_add.html' %} 

我在/型材/ picomon越來越TemplateSyntaxError/

RelationshipStatus not found 
Request Method: GET 
Request URL: http://127.0.0.1:8000/profiles/picomon/ 
Django Version: 1.3.1 
Exception Type: TemplateSyntaxError 
Exception Value:  
RelationshipStatus not found 
Exception Location: build\bdist.win32\egg\relationships\templatetags\relationship_tags.py in render, line 32 
Python Executable: C:\Python27\python.exe 
Python Version: 2.7.2 

Template error 

In template c:\python27\scripts\myweb\templates\relationships\relationship_add.html, error at line 9 

下面是關係/ relationship_add.html代碼

{% load relationship_tags %} 

{% if request.user != profile.user %} 

    {# decide whether or not the current user is following this user #} 

    {% if_relationship request.user profile.user "following" %} 

    {# they are following them, so show a "remove" url #} 
    <a href="{{ profile.user|remove_relationship_url:"following" }}">Unfollow</a> 

    {% else %} 

    {# they are not following them, so show a link to start following #} 
    <a href="{{ profile.user|add_relationship_url:"following" }}">Follow</a> 



    {% endif_relationship %} 

    {% else %} 
     <p>This is you!</p> 
    {% endif %} 

我會做什麼調整來完成這項工作?請帶我通過請。

回答

0

根據我的經驗,TemplateSyntaxError並不總是表示它的意思。我會檢查所有的自定義標記和過濾器(if_relationship,remove_relationship_url,add_relationship_url)按照您的期望通過檢查shell中的核心邏輯或單元測試來工作。

在此之前,我只是從模板中刪除位,直到它再次開始工作。縮小導致問題的因素很容易。

+0

我已經嘗試了所有這些。我甚至調整它,但沒有成功!任何讓用戶相互關注的其他軟件包?非常感謝! – picomon 2012-02-19 14:23:02

相關問題