from django.shortcuts import render
from django.http import HttpResponse
from .models import *

# Create your views here.

def home(request):
    return render(request, 'accounts/home.html')

def products(request):
    products = Product.objects.all()
    return render(request, 'accounts/products.html', {'products': products})

def customer(request, pk_test):
    customer = Customer.objects.get(id = pk_test)
    orders = customer.order_set.all()
    order_count = orders.count()

    context = {'customer': customer, 'orders': orders, 'order_count': order_count}
    return render(request, 'accounts/customer.html', context)


def dashboard(request):
    customers = Customer.objects.all()
    total_customer = customers.count()
    orders = Order.objects.all()
    total_orders = orders.count()
    delivered = Order.objects.filter(status='Delivered').count()
    pending = Order.objects.filter(status='Pending').count()

    context = {
        'customers': customers,
        'orders': orders,
        'total_orders': total_orders,
        'total_customer': total_customer,
        'delivered': delivered,
        'pending': pending
    }
    return render(request, 'accounts/dashboard.html', context)
3c31d9785010993389560c0e2a87c659f96490f8
<mask token>


def customer(request, pk_test):
    customer = Customer.objects.get(id=pk_test)
    orders = customer.order_set.all()
    order_count = orders.count()
    context = {'customer': customer, 'orders': orders, 'order_count':
        order_count}
    return render(request, 'accounts/customer.html', context)


<mask token>

<mask token>


def home(request):
    return render(request, 'accounts/home.html')


def products(request):
    products = Product.objects.all()
    return render(request, 'accounts/products.html', {'products': products})


def customer(request, pk_test):
    customer = Customer.objects.get(id=pk_test)
    orders = customer.order_set.all()
    order_count = orders.count()
    context = {'customer': customer, 'orders': orders, 'order_count':
        order_count}
    return render(request, 'accounts/customer.html', context)


<mask token>

<mask token>


def home(request):
    return render(request, 'accounts/home.html')


def products(request):
    products = Product.objects.all()
    return render(request, 'accounts/products.html', {'products': products})


def customer(request, pk_test):
    customer = Customer.objects.get(id=pk_test)
    orders = customer.order_set.all()
    order_count = orders.count()
    context = {'customer': customer, 'orders': orders, 'order_count':
        order_count}
    return render(request, 'accounts/customer.html', context)


def dashboard(request):
    customers = Customer.objects.all()
    total_customer = customers.count()
    orders = Order.objects.all()
    total_orders = orders.count()
    delivered = Order.objects.filter(status='Delivered').count()
    pending = Order.objects.filter(status='Pending').count()
    context = {'customers': customers, 'orders': orders, 'total_orders':
        total_orders, 'total_customer': total_customer, 'delivered':
        delivered, 'pending': pending}
    return render(request, 'accounts/dashboard.html', context)

from django.shortcuts import render
from django.http import HttpResponse
from .models import *


def home(request):
    return render(request, 'accounts/home.html')


def products(request):
    products = Product.objects.all()
    return render(request, 'accounts/products.html', {'products': products})


def customer(request, pk_test):
    customer = Customer.objects.get(id=pk_test)
    orders = customer.order_set.all()
    order_count = orders.count()
    context = {'customer': customer, 'orders': orders, 'order_count':
        order_count}
    return render(request, 'accounts/customer.html', context)


def dashboard(request):
    customers = Customer.objects.all()
    total_customer = customers.count()
    orders = Order.objects.all()
    total_orders = orders.count()
    delivered = Order.objects.filter(status='Delivered').count()
    pending = Order.objects.filter(status='Pending').count()
    context = {'customers': customers, 'orders': orders, 'total_orders':
        total_orders, 'total_customer': total_customer, 'delivered':
        delivered, 'pending': pending}
    return render(request, 'accounts/dashboard.html', context)

from django.shortcuts import render
from django.http import HttpResponse
from .models import *

# Create your views here.

def home(request):
    return render(request, 'accounts/home.html')

def products(request):
    products = Product.objects.all()
    return render(request, 'accounts/products.html', {'products': products})

def customer(request, pk_test):
    customer = Customer.objects.get(id = pk_test)
    orders = customer.order_set.all()
    order_count = orders.count()

    context = {'customer': customer, 'orders': orders, 'order_count': order_count}
    return render(request, 'accounts/customer.html', context)


def dashboard(request):
    customers = Customer.objects.all()
    total_customer = customers.count()
    orders = Order.objects.all()
    total_orders = orders.count()
    delivered = Order.objects.filter(status='Delivered').count()
    pending = Order.objects.filter(status='Pending').count()

    context = {
        'customers': customers,
        'orders': orders,
        'total_orders': total_orders,
        'total_customer': total_customer,
        'delivered': delivered,
        'pending': pending
    }
    return render(request, 'accounts/dashboard.html', context)