コード例 #1
0
ファイル: category.py プロジェクト: summerisgone/django-lfs
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":
                SEOView(Category).render(request, category),
                "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
                  },
            }))
コード例 #2
0
ファイル: views.py プロジェクト: pir8aye/django-lfs
def manage_manufacturer(request, manufacturer_id, template_name="manage/manufacturers/manufacturer.html"):
    """The main view to display manufacturers.
    """
    manufacturer = Manufacturer.objects.get(pk=manufacturer_id)

    categories = []
    for category in Category.objects.filter(parent=None):

        # Checking state
        checked, klass = _get_category_state(manufacturer, category)

        categories.append({
            "id": category.id,
            "name": category.name,
            "checked": checked,
            "klass": klass,
        })

    return render_to_response(template_name, RequestContext(request, {
        "categories": categories,
        "manufacturer": manufacturer,
        "manufacturer_id": manufacturer_id,
        "selectable_manufacturers_inline": selectable_manufacturers_inline(request, manufacturer_id),
        "manufacturer_data_inline": manufacturer_data_inline(request, manufacturer_id),
        "seo": SEOView(Manufacturer).render(request, manufacturer),
        "view": manufacturer_view(request, manufacturer_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 = lfs_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(request, template_name, {
        "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": SEOView(Product, form_klass=SEOForm, template_name='manage/product/seo.html').render(request, product),
        "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
    url(r'^manufacturer-selected-products/(?P<manufacturer_id>\d*)$',
        "selected_products",
        name="lfs_manage_manufacturer_selected_products"),
    url(r'^manufacturer-add-products/(?P<manufacturer_id>\d*)$',
        "add_products",
        name="lfs_manage_manufacturer_add_products"),
    url(r'^manufacturer-remove-products/(?P<manufacturer_id>\d*)$',
        "remove_products",
        name="lfs_manage_manufacturer_remove_products"),
    url(r'^manufacturer-load-products-tab/(?P<manufacturer_id>\d*)$',
        "products_tab",
        name="lfs_manufacturer_load_products_tab"),
)

# Manufacturer / SEO
urlpatterns += SEOView.get_seo_urlpattern(Manufacturer)

# Marketing
urlpatterns += patterns(
    'lfs.manage.views.marketing',
    url(r'^featured$',
        "marketing.manage_featured_page",
        name="lfs_manage_featured"),
    url(r'^add-featured$',
        "featured.add_featured",
        name="lfs_manage_add_featured"),
    url(r'^update-featured$',
        "featured.update_featured",
        name="lfs_manage_update_featured"),
    url(r'^featured-inline$',
        "featured.manage_featured_inline",
コード例 #5
0
ファイル: urls.py プロジェクト: DenisVasiliev/django-lfs
    url(r'^manufacturer-inline/(?P<manufacturer_id>\d*)/(?P<category_id>\d*)$', "manufacturer_inline", name="lfs_manufacturer_inline"),
    url(r'^manufacturers-ajax/$', "manufacturers_ajax", name="lfs_manufacturers_ajax"),
    url(r'^no-manufacturers$', "no_manufacturers", name="lfs_manage_no_manufacturers"),
    url(r'^edit-manufacturer-view/(?P<manufacturer_id>\d*)$', "manufacturer_view", name="lfs_manage_manufacturer_view"),
)

urlpatterns += patterns('lfs.manage.manufacturers.products',
    url(r'^manufacturer-products-inline/(?P<manufacturer_id>\d*)$', "products_inline", name="lfs_manage_manufacturer_products_inline"),
    url(r'^manufacturer-selected-products/(?P<manufacturer_id>\d*)$', "selected_products", name="lfs_manage_manufacturer_selected_products"),
    url(r'^manufacturer-add-products/(?P<manufacturer_id>\d*)$', "add_products", name="lfs_manage_manufacturer_add_products"),
    url(r'^manufacturer-remove-products/(?P<manufacturer_id>\d*)$', "remove_products", name="lfs_manage_manufacturer_remove_products"),
    url(r'^manufacturer-load-products-tab/(?P<manufacturer_id>\d*)$', "products_tab", name="lfs_manufacturer_load_products_tab"),
)

# Manufacturer / SEO
urlpatterns += SEOView.get_seo_urlpattern(Manufacturer)

# Marketing
urlpatterns += patterns('lfs.manage.views.marketing',
    url(r'^featured$', "marketing.manage_featured_page", name="lfs_manage_featured"),
    url(r'^add-featured$', "featured.add_featured", name="lfs_manage_add_featured"),
    url(r'^update-featured$', "featured.update_featured", name="lfs_manage_update_featured"),
    url(r'^featured-inline$', "featured.manage_featured_inline", name="lfs_manage_featured_inline"),
    url(r'^marketing$', "marketing.manage_marketing", name="lfs_manage_marketing"),
    url(r'^manage-rating-mails$', "rating_mails.manage_rating_mails", name="lfs_manage_rating_mails"),
    url(r'^add-topseller$', "topseller.add_topseller", name="lfs_manage_add_topseller"),
    url(r'^update-topseller$', "topseller.update_topseller", name="lfs_manage_update_topseller"),
    url(r'^topseller-inline$', "topseller.manage_topseller_inline", name="lfs_manage_topseller_inline"),
    url(r'^send-rating-mails$', "rating_mails.send_rating_mails", name="lfs_send_rating_mails"),
)