create a blog with django code example
Example 1: create blog in django
cd Desktop
virtualenv django
cd django
Scripts\activate.bat
Example 2: blog in django
from django.views import generic
from .models import Post
class PostList(generic.ListView):
queryset = Post.objects.filter(status=1).order_by('-created_on')
template_name = 'index.html'
class PostDetail(generic.DetailView):
model = Post
template_name = 'post_detail.html'