def search(request):
    form = SearchForm(request.POST)
    books = models.Book.objects.filter(title=form.data['title'])
    res = render(request, 'BRMapp/searchbook.html', {
        'form': form,
        'books': books
    })
    return res
Exemple #2
0
def search(request):
    form = SearchForm(request.POST)
    products = models.Product.objects.filter(
        title__startswith=form.data['title'])
    #products=models.Product.objects.filter(company__startswith=form.data['company'])
    #products=models.Product.objects.filter(distributer__startswith=form.data['distributer'])
    #products=models.Product.objects.filter(title=form.data['title'])
    res = render(request, 'BRMapp/search_product.html', {
        'form': form,
        'products': products
    })
    return res
Exemple #3
0
def searchBook(request):
    try:
        username = request.session['username']
    except:
        return HttpResponseRedirect('login')
    else:
        form = SearchForm()
        res = render(request, 'BRMapp/search_book.html', {
            'form': form,
            'username': username
        })
        return res
Exemple #4
0
def search(request):
    try:
        username = request.session['username']
    except:
        return HttpResponseRedirect('login')
    else:
        x = 0
        form = SearchForm(request.POST)
        books = models.Book.objects.filter(title=form.data['title'])
        if len(books) == 0:
            x = 1
        res = render(request, 'BRMapp/search_book.html', {
            "books": books,
            "form": form,
            "x": x,
            'username': username
        })
        return res
Exemple #5
0
def searchBook(request):
    form=SearchForm()
    return render(request,'BRMapp/search_book.html',{'form':form})
Exemple #6
0
def search(request):
    form=SearchForm(request.POST)
    username=request.session['username']
    books=models.Book.objects.filter(title=form.data['title'])
    res=render(request,'BRMapp/search-book.html',{'form':form,'books':books,'username':username})
    return res
Exemple #7
0
def searchBook(request):
    form=SearchForm()
    username=request.session['username']
    res=render(request,'BRMapp/search-book.html',{'form':form,'username':username})
    return res
Exemple #8
0
def searchProduct(request):
    form = SearchForm()
    res = render(request, 'BRMapp/search_product.html', {'form': form})
    return res
Exemple #9
0
def searchBook(request):  # only displays the search form
    form = SearchForm()
    res = render(request, 'BRMapp/search_book.html', {'form': form})
    return res
def search(request):
    form = SearchForm(request.POST)
    books = models.Book.objects.filter(title=form.data['title'])