예제 #1
0
def manage_product(request, product_id, template_name="manage/product/product.html"):
    """
    Displays the whole manage/edit form for the product with the passed id.
    """
    product = muecke_get_object_or_404(Product, pk=product_id)
    products = _get_filtered_products_for_product_view(request)
    paginator = Paginator(products, 25)
    temp = product.parent if product.is_variant() else product
    page = get_current_page(request, products, temp, 25)

    try:
        page = paginator.page(page)
    except EmptyPage:
        page = paginator.page(1)

    return render_to_response(template_name, RequestContext(request, {
        "product": product,
        "product_filters": product_filters_inline(request, page, paginator, product_id),
        "pages_inline": pages_inline(request, page, paginator, product_id),
        "product_data": product_data_form(request, product_id),
        "images": manage_images(request, product_id, as_string=True),
        "attachments": manage_attachments(request, product_id, as_string=True),
        "selectable_products": selectable_products_inline(request, page, paginator, product.id),
        "seo": manage_seo(request, product_id),
        "stock": stock(request, product_id),
        "portlets": portlets_inline(request, product),
        "properties": manage_properties(request, product_id),
        "form": ProductSubTypeForm(instance=product),
        "name_filter_value": request.session.get("product_filters", {}).get("product_name", ""),
    }))
예제 #2
0
def selectable_customers_inline(
        request,
        customer_id,
        template_name="manage/customer/selectable_customers_inline.html"):
    """Display selectable customers.
    """
    AMOUNT = 30
    customer = muecke_get_object_or_404(Customer, pk=customer_id)
    customer_filters = request.session.get("customer-filters", {})
    customers = _get_filtered_customers(request, customer_filters)

    page = get_current_page(request, customers, customer, AMOUNT)
    paginator = Paginator(customers, AMOUNT)

    try:
        page = paginator.page(page)
    except EmptyPage:
        page = paginator.page(1)

    return render_to_string(
        template_name,
        RequestContext(
            request, {
                "paginator": paginator,
                "page": page,
                "customer_id": int(customer_id),
            }))
예제 #3
0
def manage_product(request,
                   product_id,
                   template_name="manage/product/product.html"):
    """
    Displays the whole manage/edit form for the product with the passed id.
    """
    product = muecke_get_object_or_404(Product, pk=product_id)
    products = _get_filtered_products_for_product_view(request)
    paginator = Paginator(products, 25)
    temp = product.parent if product.is_variant() else product
    page = get_current_page(request, products, temp, 25)

    try:
        page = paginator.page(page)
    except EmptyPage:
        page = paginator.page(1)

    return render_to_response(
        template_name,
        RequestContext(
            request, {
                "product":
                product,
                "product_filters":
                product_filters_inline(request, page, paginator, product_id),
                "pages_inline":
                pages_inline(request, page, paginator, product_id),
                "product_data":
                product_data_form(request, product_id),
                "images":
                manage_images(request, product_id, as_string=True),
                "attachments":
                manage_attachments(request, product_id, as_string=True),
                "selectable_products":
                selectable_products_inline(request, page, paginator,
                                           product.id),
                "seo":
                manage_seo(request, product_id),
                "stock":
                stock(request, product_id),
                "portlets":
                portlets_inline(request, product),
                "properties":
                manage_properties(request, product_id),
                "form":
                ProductSubTypeForm(instance=product),
                "name_filter_value":
                request.session.get("product_filters", {}).get(
                    "product_name", ""),
            }))
예제 #4
0
def selectable_customers_inline(request, customer_id, template_name="manage/customer/selectable_customers_inline.html"):
    """Display selectable customers.
    """
    AMOUNT = 30
    customer = muecke_get_object_or_404(Customer, pk=customer_id)
    customer_filters = request.session.get("customer-filters", {})
    customers = _get_filtered_customers(request, customer_filters)

    page = get_current_page(request, customers, customer, AMOUNT)
    paginator = Paginator(customers, AMOUNT)

    try:
        page = paginator.page(page)
    except EmptyPage:
        page = paginator.page(1)

    return render_to_string(template_name, RequestContext(request, {
        "paginator": paginator,
        "page": page,
        "customer_id": int(customer_id),
    }))