You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
845 B
35 lines
845 B
from django.shortcuts import render
|
|
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
|
|
|
|
from .models import WorkSell
|
|
from .forms import WorkSellForm
|
|
|
|
|
|
class WorkSellsView(ListView):
|
|
model = WorkSell
|
|
template_name = 'worksells_list.html'
|
|
paginate_by = 20
|
|
|
|
|
|
class WorkSellDetail(DetailView):
|
|
model = WorkSell
|
|
template_name = 'worksell_detail.html'
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
context['worksell_related'] = WorkSell.objects.all()[:5]
|
|
return context
|
|
|
|
|
|
class WorkSellCreateView(CreateView):
|
|
model = WorkSell
|
|
form_class = WorkSellForm
|
|
template_name = 'worksell_create.html'
|
|
|
|
|
|
class WorkSellUpdateView(CreateView):
|
|
model = WorkSell
|
|
|
|
|
|
class WorkSellDeleteView(CreateView):
|
|
model = WorkSell
|
|
|