示例#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 manage_page(request, id, template_name="manage/pages/page.html"):
    """Provides a form to edit the page with the passed id.
    """
    page = get_object_or_404(Page, pk=id)

    return render_to_response(template_name, RequestContext(request, {
        "page": page,
        "navigation": navigation(request, page),
        "seo_tab": seo_tab(request, page),
        "data_tab": data_tab(request, page),
        "portlets": portlets_inline(request, page),
    }))
示例#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 manage_category(request, category_id, template_name="manage/category/manage_category.html"):
    """Displays the form to manage the category with given category id.
    """
    category = Category.objects.get(pk=category_id)

    return render_to_response(template_name, RequestContext(request, {
        "categories_portlet": manage_categories_portlet(request, category_id),
        "category": category,
        "data": category_data(request, category_id),
        "seo": edit_seo(request, category_id),
        "view": category_view(request, category_id),
        "portlets": portlets_inline(request, category),
        "dialog_message": _("Do you really want to delete the category <b>'%(name)s'</b> and all its sub categories?") % {"name": category.name},
    }))
示例#5
0
def manage_page(request, id, template_name="manage/pages/page.html"):
    """Provides a form to edit the page with the passed id.
    """
    page = get_object_or_404(Page, pk=id)

    return render_to_response(
        template_name,
        RequestContext(
            request, {
                "page": page,
                "navigation": navigation(request, page),
                "seo_tab": seo_tab(request, page),
                "data_tab": data_tab(request, page),
                "portlets": portlets_inline(request, page),
            }))