Exemple #1
0
def show_index(request):
	context = get_context(request)
	context['carousel'] = get_goods_for_carousel()
	context['new_items'] = get_goods_for_new()
	context['sale_items'] = get_goods_for_sale()
	context['hot_items'] = get_goods_for_hot()

	return render(request, 'baseapp/index.html', context)
Exemple #2
0
def show_item(request, slug):

    good = find_good_by_slug(slug=slug)
    if not good:
        return redirect(request.META['HTTP_REFERER'])

    context = get_context(request)

    parent = good.category
    childs = get_childs(parent=parent)

    context['parent'] = parent
    context['childs'] = childs
    context['good'] = good

    return render(request, 'catalogapp/item.html', context)
Exemple #3
0
def send_contact_form(request):

	context = get_context(request)

	if request.method == 'POST':

		contactForm = ContactForm(request.POST)

		if contactForm.is_valid():

			name = contactForm.cleaned_data['contactName']
			phone = contactForm.cleaned_data['contactPhone']
			message = contactForm.cleaned_data['contactMessage']

			send_mail(name, phone, message)

			return render(request, 'baseapp/contact_form_success.html', context)

		else:

			return render(request, 'baseapp/contact_form_error.html', context)
Exemple #4
0
def render_list(request, goods, parent, addon=""):

    goods_count = 15

    childs = get_childs(parent=parent)

    page_number = request.GET.get('page', 1)
    paginator = Paginator(goods, goods_count)
    page = paginator.get_page(page_number)
    is_paginated = page.has_other_pages()

    context = get_context(request, parent)

    context['parent'] = parent
    context['childs'] = childs
    context['goods_count'] = len(goods)
    context['page'] = page
    context['is_paginated'] = is_paginated
    context['addon'] = addon

    return render(request, 'catalogapp/list.html', context)
Exemple #5
0
def show_news(request):
	context = get_context(request)
	return render(request, 'baseapp/news.html', context)
Exemple #6
0
def show_brands(request):
	context = get_context(request)
	return render(request, 'baseapp/brands.html', context)
Exemple #7
0
def show_map(request):
	context = get_context(request)
	return render(request, 'baseapp/map.html', context)
Exemple #8
0
def show_agreement(request):
	context = get_context(request)
	return render(request, 'baseapp/agreement.html', context)
Exemple #9
0
def show_delivery(request):
	context = get_context(request)
	return render(request, 'baseapp/delivery.html', context)
Exemple #10
0
def show_contacts(request):
	context = get_context(request)
	return render(request, 'baseapp/contacts.html', context)
Exemple #11
0
def show_about(request):
	context = get_context(request)
	return render(request, 'baseapp/about.html', context)
Exemple #12
0
def show_wishlist(request):
	# if request.user.is_authenticated:	
	return render(request, 'wishlistapp/wishlist.html', get_context(request))
Exemple #13
0
def order_success(request, id):

    context = get_context(request)
    context['order'] = get_order(id)
    return render(request, 'orderapp/order_success.html', context)
Exemple #14
0
def show_order(request, id):

    context = get_context(request)

    context['order'] = get_order(id)
    return render(request, 'orderapp/order.html', context)
Exemple #15
0
def show_orders(request):

    context = get_context(request)
    if request.user.is_authenticated:
        context['orders'] = get_orders(context['buyer'])
    return render(request, 'orderapp/orders.html', context)