コード例 #1
0
def main(request):

    criteria = ['mimetype:image/jpeg', '-owner:[* TO *]']
    try:
        criteria.append('allcollections:%d' %
                        Collection.objects.get(name='front-page-content').id)
    except Collection.DoesNotExist:
        pass

    (hits, records, search_facets, orfacet, query, fields) = run_search(
        request.user,
        criteria=criteria,
        sort='random_%d asc' % random.randint(100000, 999999),
        page=1,
        pagesize=8,
        produce_facets=False)

    order = range(1, len(records or []))
    random.shuffle(order)

    request.session.set_test_cookie()
    form = AuthenticationForm()

    if is_mobile(request):
        return HttpResponseRedirect(reverse("mobile-main"))

    return render_to_response('main.html', {
        'records': records,
        'order': [0] + order,
        'login_form': form
    },
                              context_instance=RequestContext(request))
コード例 #2
0
ファイル: views.py プロジェクト: Blanko2/vic-mdid
def main(request):

    criteria = ['mimetype:image/jpeg', '-owner:[* TO *]']
    try:
        criteria.append('allcollections:%d' %
                        Collection.objects.get(name='front-page-content').id)
    except Collection.DoesNotExist:
        pass

    (hits, records, search_facets, orfacet, query, fields) = run_search(
        request.user,
        criteria=criteria,
        sort='random_%d asc' % random.randint(100000, 999999),
        page=1,
        pagesize=8,
        produce_facets=False)

    order = range(1, len(records or []))
    random.shuffle(order)

    request.session.set_test_cookie()
    form = AuthenticationForm()

    if is_mobile(request):
        return HttpResponseRedirect(reverse("mobile-main"))

    return render_to_response('main.html',
                              {'records': records,
                               'order': [0] + order,
                               'login_form': form},
                              context_instance=RequestContext(request))
コード例 #3
0
def presentationviewer(obj, request, objid=None):
    presentation = _get_presentation(obj, request, objid)
    # if the user agent is mobile, redirect to the HTML presentation
    if is_mobile(request):
             return HTMLPresentation(presentation, request.user) if presentation else None
    # else, return the Flash viewer
    return PresentationViewer(presentation, request.user) if presentation else None
コード例 #4
0
def presentationviewer(obj, request, objid=None):
    print 'gimme dat baby, then'
    presentation = _get_presentation(obj, request, objid)
    # if the user agent is mobile, redirect to the HTML presentation
    if is_mobile(request):
        return HTMLPresentation(presentation,
                                request.user) if presentation else None
    # else, return the Flash viewer
    if presentation:
        print 'i got the presentation line 68'
    else:
        print ' i dont got the presentation line 70'
    return PresentationViewer(presentation,
                              request.user) if presentation else None