2012-02-18 65 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

相关问题