def detail(request, topic_guid):
  fetcher = Fetch()
  topic = fetcher.get_topic(topic_guid)
  images = fetcher.get_images(topic_guid)
  related_topics = fetcher.get_related_topic(topic_guid)
  context_instance=RequestContext(request)

  return render_to_response('newscred/detail.html', {'topic': topic, 'images': images, 'related_topics': related_topics}, context_instance)
def update(request, topic_guid):
  fetcher = Fetch()
  topic_info = fetcher.get_topic(topic_guid)

  #merge the edited on with the fetched one
  topic_info['name'] =  request.POST['topic_title']
  topic = Topic(name=topic_info['name'], topic_group=topic_info['topic_group'], description=topic_info['description'],guid=topic_guid)
  topic.save()

  return HttpResponse(True)
Example #3
0
def detail(request, topic_guid):
    fetcher = Fetch()
    topic = fetcher.get_topic(topic_guid)
    images = fetcher.get_images(topic_guid)
    related_topics = fetcher.get_related_topic(topic_guid)
    context_instance = RequestContext(request)

    return render_to_response('newscred/detail.html', {
        'topic': topic,
        'images': images,
        'related_topics': related_topics
    }, context_instance)
Example #4
0
def update(request, topic_guid):
    fetcher = Fetch()
    topic_info = fetcher.get_topic(topic_guid)

    #merge the edited on with the fetched one
    topic_info['name'] = request.POST['topic_title']
    topic = Topic(name=topic_info['name'],
                  topic_group=topic_info['topic_group'],
                  description=topic_info['description'],
                  guid=topic_guid)
    topic.save()

    return HttpResponse(True)
def index(request):
  topics = []
  query = request.GET.get('q', '')

  if query:
    fetcher = Fetch()
    topics = fetcher.get_topics(query)

    if topics:
      #check if the topic is present in db
      for index, topic in enumerate(topics):
        topics[index] = augment_topic(topic)

  context_instance=RequestContext(request)
  return render_to_response('newscred/index.html', {'q': query, 'topics': topics}, context_instance)
Example #6
0
def index(request):
    topics = []
    query = request.GET.get('q', '')

    if query:
        fetcher = Fetch()
        topics = fetcher.get_topics(query)

        if topics:
            #check if the topic is present in db
            for index, topic in enumerate(topics):
                topics[index] = augment_topic(topic)

    context_instance = RequestContext(request)
    return render_to_response('newscred/index.html', {
        'q': query,
        'topics': topics
    }, context_instance)