コード例 #1
0
ファイル: views.py プロジェクト: unomena/jmbo-foundry
def search(request):
    if request.method == 'POST':
        form = SearchForm(request.POST) 
        if form.is_valid():
            return HttpResponseRedirect('/')
    else:
        form = SearchForm() 

    extra = dict(form=form)
    return render_to_response('foundry/search.html', extra, context_instance=RequestContext(request))
コード例 #2
0
ファイル: views.py プロジェクト: jurginius/jmbo-foundry
def search(request):
    if request.method == 'POST':
        form = SearchForm(request.POST) 
        if form.is_valid():
            param = urllib.quote(form.cleaned_data['search_term'])
            return HttpResponseRedirect(
                reverse('search-results') + '?search_term=' + param
            )
    else:
        form = SearchForm() 

    extra = dict(form=form)
    return render_to_response('foundry/search.html', extra, context_instance=RequestContext(request))