Ejemplo n.º 1
0
def item(request, slug):
    c = get_common_context(request)
    if request.method == 'POST':
        if request.POST['action'] == 'add_in_basket':
            c['cart_working'].add_to_cart(request.user, request.POST['item_id'], 1)
        return HttpResponseRedirect(request.get_full_path())
    c['item'] = Item.get_by_slug(slug)
    c['category'] = c['item'].category
    c['same'] = Item.objects.filter(category__in=c['category'].get_descendants(include_self=True)).order_by('?')[0:4]
    c['in_cart'] = c['cart_working'].present_item(request.user, c['item'].id)
    return render_to_response('item.html', c, context_instance=RequestContext(request))
Ejemplo n.º 2
0
def item(request, slug):
    c = get_common_context(request)
    item = Item.get_by_slug(slug)
    c['category'] = item.category
    page = c['category']
    breadcrumbs = []
    while page:
        breadcrumbs.append(page)
        page = page.parent
    breadcrumbs.reverse()
    c['titles'] = breadcrumbs
    c['item'] = item
    return render_to_response('item.html', c, context_instance=RequestContext(request))
Ejemplo n.º 3
0
Archivo: views.py Proyecto: kpx13/okna
def item(request, slug):
    c = get_common_context(request)
    c['item'] = Item.get_by_slug(slug)
    c['category'] = c['item'].category
    c['title'] = c['item'].name
    return render_to_response('item.html', c, context_instance=RequestContext(request))