1

我有一个大的 JSON 对象(来自 Google Feed API)和一个来自上下文的 URL。当上下文中的 URL 与提要条目 URL 中的 URL 相同时,django 应该解析!

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

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

这不工作!

编辑:

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"}
4

1 回答 1

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

需要是

{% ifequal aEntry.link my_URL %}
于 2012-09-13T15:19:39.217 回答