Skip to content

Instantly share code, notes, and snippets.

@aballah-chamakh
Last active June 29, 2019 08:41
Show Gist options
  • Save aballah-chamakh/0a1c681128e0ccee3a6e712968529881 to your computer and use it in GitHub Desktop.
Save aballah-chamakh/0a1c681128e0ccee3a6e712968529881 to your computer and use it in GitHub Desktop.
from django.shortcuts import render
from django.views.generic import ListView,DetailView,CreateView,UpdateView,DeleteView
from .models import Product
from .forms import ProductForm
class ProductListView(ListView):
queryset = Product.objects.all()
template_name = 'product_view.html'
class ProductDetaiView(DetailView):
model = Porduct
template_name = 'product_detail.html'
class ProductCreateView(CreateView):
model = Product
form_class = PorductForm
template_name = 'product_create.html'
success_url = '/'
class ProductUpdateView(UpdateView):
model = Product
form_class= PorductForm
template_name = 'product_update.html'
success_url = '/'
class ProductDeleteView(UpdateView):
model = Product
template_name = 'product_delete.html'
success_url = '/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment