示例#1
0
def render(request,page=1):

    try:
        video = Video.objects.filter(page_id=page)[0]
    except IndexError:
        return False
    options = {}

    query = video.query
    to_date = video.to_date
    from_date = video.from_date
    page_size = video.page_size

    if query:
        options['query'] = query
    if to_date:
        options['to_date'] =to_date
    if from_date:
        options['from_date'] =from_date
    if page_size:
        options['pagesize'] = page_size

    video_obj = NewscredApi('videos', options)

    return video_obj.response()
示例#2
0
def render(request, page=1):
    ## galleris = to get the all galleries by using Gallery model class . .query
    try:
        gallery = Gallery.objects.filter(page_id=page)[0]
    except IndexError:
        return False

    options = {}

    query = gallery.query
    to_date = gallery.to_date
    from_date = gallery.from_date
    page_size = gallery.page_size

    if query:
        options["query"] = query
    if to_date:
        options["to_date"] = to_date
    if from_date:
        options["from_date"] = from_date
    if page_size:
        options["pagesize"] = page_size

    gallery_obj = NewscredApi("images", options)
    return gallery_obj.response()
示例#3
0
def render(request, page=1):
    ## galleris = to get the all galleries by using Gallery model class . .query
    try:
        topic = Topic.objects.filter(page_id=page)[0]
    except IndexError:
        return False
    options = {}

    query = topic.query
    pagesize = topic.pagesize

    if query:
        options['query'] = query
    if pagesize:
        options['pagesize'] = pagesize

    article_obj = NewscredApi('topics', options)
    return article_obj.response()