Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. from django.views.generic import *
  2. from  movie2.models import *
  3. from  movie2.forms import *
  4.  
  5.  
  6.  
  7. class BlogListView(ListView):
  8.     template_name = "bloglist.html"
  9.     model = Blog #we may have othe datatable so  speciang here.
  10.     context_object_name = "blogs" # sending data from view to template with name bogs
  11.  
  12.  
  13. class BlogDetailView(DetailView):
  14.     template_name = "blogdetail.html"
  15.     model = Blog #we may have othe datatable so  speciang here.
  16.     context_object_name = "blogdetail" # sending data from view to template with name bogs
  17.  
  18.  
  19. class BlogCreateView(CreateView):
  20.     template_name = "blogcreate.html"
  21.     form_class =BlogForm
  22.     success_url='/movie2/blog/list/'
  23.  
  24.  
  25. class BlogUpdateView(UpdateView):
  26.     template_name = "blogcreate.html"
  27.     model= Blog
  28.     form_class =BlogForm
  29.     success_url='/movie2/blog/list/'
  30.  
  31.  
  32. class BlogDeleteView(DeleteView):
  33.     template_name = "blogdelete.html"
  34.     model= Blog
  35.     success_url='/movie2/blog/list/'
  36.  
  37.  
  38.  
  39. # Create your views here.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement