Example #1
0
def index(request):
    fields = Location.get_boolean_fields()
    st = ''
    selected = '2'

    if request.POST and 'searchText' in request.POST:
        st = request.POST['searchText']
        selected = request.POST['searchRadius']

    ctx = RequestContext(request, {
        'fields': fields,
        'searchText': st,
        'options': get_opts(selected),
        'mapbarEnabled': True
    })

    response = render_to_response('index.html', context_instance=ctx)

    # cookie for splash screen, defaults to true
    try:
        show_splash = request.COOKIES['show_splash']
        if show_splash == 'true':
            expires = datetime.utcnow() + timedelta(seconds=60 * 60)
            response.set_cookie('show_splash', 'false', expires=expires, httponly=False)
    except:
        response.set_cookie('show_splash', 'true')

    return response