I’m using coleifer/Django-Relationships package for my project. I’ve been having a rough time in making it work.
I included the template ‘relationship_add.html’ in user profiles template, so that when a user finds another user and if both are not following each other, it will be easy for the user to click on follow button in order to follow each other.
After including the template in user profiles template:
{% include 'relationships/relationship_add.html' %}
I’m getting TemplateSyntaxError at /profiles/picomon/
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
Below are the codes in relationships/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 %}
What adjustment will I do to make this work? Kindly put me through please.
In my experience, a TemplateSyntaxError doesn’t always mean what it says. I would check all your custom tags and filters (if_relationship, remove_relationship_url, add_relationship_url) are working as you expect by checking the core logic in the shell or with a unit test.
Before that, I’d just remove bits from the template until it starts working again. It’ll be pretty easy to narrow down what’s causing the problem.