def main_view(request): message = handle_request_get_message(request) autocomplete_data = get_autocomplete_data(request) user_login = get_user_login_object(request) new_notify = get_new_notify(request) books = [] people = [] if request.method == "GET": if "q" in request.GET: query = request.GET['q'] if len(query) != 0: book_by_isbn = get_book_by_isbn(query) book_by_title = get_book_by_title(query) book_by_author = get_book_by_author(query) books = remove_duplicate_object(book_by_isbn + book_by_title + book_by_author) people = get_people_by_name(request,query) for person in people: person.get_profile().partner_status = check_partnership(request,person.username) person.get_profile().save() return render_to_response( "app/search/page/main_view.html", { 'message': message, 'autocomplete_data': autocomplete_data, 'user_login': user_login, 'books': books, 'people': people, 'new_notify': new_notify, }, context_instance=RequestContext(request) )
def buy_book_search_title_author(request): user_login = get_user_login_object(request) new_notify = get_new_notify(request) title,author = "","" if 'title' in request.session: title = request.session['title'] if 'author' in request.session: author = request.session['author'] books = [] if len(title) != 0 and len(author) != 0: books = get_book_by_title_and_author(title,author) else: if len(title) != 0: books = get_book_by_title(title) elif len(author) != 0: books = get_book_by_author(author) #book_sellings = BookTransaction.objects.filter(transaction_type='1') return render_to_response( "app/book/page/buy/buy_search.html", { 'user_login': user_login, 'new_notify': new_notify, 'books': books, #'book_sellings': book_sellings } ,context_instance=RequestContext(request))
def trade_give_book_search(request): user_login = get_user_login_object(request) new_notify = get_new_notify(request) title = request.session['book_title'] author = request.session['book_author'] books = [] if len(title) != 0 and len(author) != 0: books = get_book_by_title_and_author(title,author) else: if len(title) != 0: books = get_book_by_title(title) elif len(author) != 0: books = get_book_by_author(author) return render_to_response( "app/book/page/trade_give/trade_give_search.html", { 'user_login': user_login, 'new_notify': new_notify, 'books': books } ,context_instance=RequestContext(request))