2012-02-18 8 views
0

私のプロジェクトにはcoleifer/Django-Relationshipsパッケージを使用しています。私はそれを動作させるのに荒い時間を過ごしてきました。Djangoの関係 - TemplateSyntaxerror

ユーザープロファイルテンプレートに「relationship_add.html」というテンプレートが含まれているため、ユーザーが別のユーザーを見つけたときに、両方がお互いに似ていない場合は、フォローボタンをクリックするのが簡単になります互いに従ってください。

は、ユーザーでテンプレートを含めた後、プロファイルテンプレート:私は/プロファイル/ picomonでTemplateSyntaxErrorを取得しています

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

/以下

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)がすべてシェルのコアロジックをチェックするか、単体テストをチェックすることで期待通りに動いているかチェックします。

これまで、テンプレートからビットを削除してから、もう一度作業を開始します。問題の原因を絞り込むのはかなり簡単です。

+0

私はそれをすべて試しました。私もそれを微調整し、まだ成功しません!ユーザーをお互いに追いかける他のパッケージ?本当にありがとう! – picomon

関連する問題