Example #1
0
def look_orders_page(request):
    user = auth.get_user(request)
    page = request.GET.get('page', 1)
    orders = get_orders_by_user(user)

    contacts = get_books_to_page(orders, page=page)
    return render(request, 'user/look_orders_page.html', {'user': user, 'contacts': contacts})
Example #2
0
def home(request):
    user = auth.get_user(request)
    page = request.GET.get('page', 1)
    if request.method == 'POST':
        search_info = request.POST.get('search_info', "")
        books = get_books_by_search_info(search_info)
        contacts = get_books_to_page(books, page=page)
        return render(request, 'manager/home.html', {
            'user': user,
            'contacts': contacts,
        })
    else:  # 正常访问
        books = get_books_by_search_info()
        contacts = get_books_to_page(books, page=page)
        return render(request, 'manager/home.html', {
            'user': user,
            'contacts': contacts,
        })
Example #3
0
def home(request):
    user = auth.get_user(request)
    page = request.GET.get('page', 1)
    if request.method == 'POST':
        search_info = request.POST.get('search_info', "")
        books = get_books_by_search_info(search_info, ignore_sold_out=True)
    else:  # 正常访问
        search_info = request.GET.get("search_info", "")
        if search_info == "":
            books = get_books_by_search_info(ignore_sold_out=True)
        else:
            search_info = urllib.parse.unquote(search_info)
            books = get_books_by_search_info(search_info, ignore_sold_out=True)

    contacts = get_books_to_page(books, page=page)
    contacts.page_max_limit = contacts.number + 5
    contacts.page_min_limit = contacts.number - 5
    return render(request, 'user/home.html',
                  {'user': user, 'contacts': contacts})
Example #4
0
def look_trove_page(request):
    user = auth.get_user(request)
    page = request.GET.get('page', 1)
    books = get_book_by_user_trove(user)
    contacts = get_books_to_page(books, page=page)
    return render(request, 'user/look_trove_page.html', {'user': user, 'contacts': contacts})