from django.shortcuts import render
from django.views.generic import ListView, DetailView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from .models import ManufacturingOrder

@method_decorator(login_required, name='dispatch')
class ManufactureListView(ListView):
    model = ManufacturingOrder
    template_name = 'manufacture/manufacture_list.html'
    context_object_name = 'manufacturing_orders'
    paginate_by = 20

@method_decorator(login_required, name='dispatch')
class ManufactureDetailView(DetailView):
    model = ManufacturingOrder
    template_name = 'manufacture/manufacture_detail.html'
    context_object_name = 'manufacturing_order'
