from django.shortcuts import render,get_object_or_404
from .models import Post

# Create your views here.
def post_list(request):
    posts = Post.objects.all()
    context = {'posts': posts}
    return render(request,'adminblog/post/list.html',context)
def post_detail(request,year,month,day,post):
    post = get_object_or_404(Post, slug=post,status='published',publish__year=year,publish__month=month,publish__day=day)
    print(post)
    context = {
        'post':post
    }
    return render(request,'adminblog/post/detail.html',context)