Dennis Ritchie
Dennis Ritchie

Reputation: 640

Django if tag not evaluating equality

I have got a big JSON object (from Google Feed API) and a URL from context. When ever the URL from context is same as in a feed entry URL, django should parse!

{for aEntry in feed.entries %}
{% if aEntry.link == {{my_URL}} %}

<p>URL FOUND in feed entry</p>
{% endif %}
{% endfor %}

This is not working!!

Edit:

feed: {
            "feedUrl": "http://.blogspot.in//feeds/posts/default",
            "title": "",
            "link": "http://.blogspot.com/",
            "author": "",
            "description": "",
            "type": "atom10",
            "entries": [{
                "title": "Shades",
                "link": "http://.blogspot.com/myurl.html",
                "author": "",
                "publishedDate": "Sun, 29 Jul 2012 04:07:00 -0700",
                "contentSnippet": "abstract art!",
                "content": " HTML CONTENT HERE",
                "categories": ["abstract"]
            }

context = { "feed" : feed, "my_url" : "http://.blogspot.com/myurl.html"}

Upvotes: 1

Views: 649

Answers (1)

karthikr
karthikr

Reputation: 99680

{% if "aEntry.link" == {{my_URL}} %}

needs to be

{% ifequal aEntry.link my_URL %}

Upvotes: 5

Related Questions