Esempio n. 1
0
def detail(request, topic_id):
    topic = Fetcher.search_topic(Fetcher(), topic_id)

    saved_topic = Topic.objects.filter(guid = topic_id).exists()

    if saved_topic:
        saved_topic = Topic.objects.get(guid = topic_id)
        topic['topic_group']  = saved_topic.group

    if not topic:
        raise Http404

    related_topics = Fetcher.search_related_topics(Fetcher(), topic_id)

    data = {'topic' : topic, 'related_topics' : related_topics}
    context = RequestContext(request)
    context.update(data)

    return render_to_response('newscred/detail.html', context)
 def render(self, context):
     self.guid = self.guid.resolve(context)
     topic = Fetcher.search_topic(Fetcher(), self.guid)
     return mark_safe("<div class='topic'><div class='topic_thumb'><img src='%s'/></div>%s<br/>URL: <a href='%s'>%s</a></div>" %
                      (topic['image_url'], topic['description'], topic['link'], topic['link'], ) )