12345678910111213141516171819202122232425262728293031323334 |
- from django.contrib.auth.views import LoginView, LogoutView
- from django.shortcuts import render
- from django.urls import reverse_lazy
- from django.views.generic import TemplateView, ListView, CreateView, UpdateView, DeleteView
- from .models import *
- from .forms import *
- class HomeView(ListView):
- model = Product
- template_name = 'index.html'
- context_object_name = 'products'
- def get_queryset(self):
- return Product
- class CreatProduct(CreateView):
- model = Product
- form_class = ProductForm
- template_name = 'createProduct.html'
- success_url = reverse_lazy('home')
- class Login(LoginView):
- template_name = 'login.html'
- class Logout(LogoutView):
- template_name = 'logout.html'
- class Profile(TemplateView):
- template_name = 'Profile.html'
|