<file_sep>from django.urls import path
from .views import home, post_detail, about


urlpatterns = [
    #path(url-name, function)
    path('', home),
    path('posts/<int:id>', post_detail),
    path('about',about),

]

<file_sep>from django.db import models

# Create your models here.
class Post(models.Model):
    title = models.CharField(max_length=80)
    body = models.TextField()
    date_created = models.DateTimeField(auto_now_add=True)
    date_updated = models.DateTimeField(auto_now=True)
    feature_pic = models.ImageField(upload_to="cover/", null=True, blank=True)
    def __str__(self):
        return self.title<file_sep>from django.contrib import admin
from .models import Post
from django_summernote.admin import SummernoteModelAdmin
# Register your models here.

class PostAdmin(SummernoteModelAdmin):
    summernote_fields = '__all__'
    list_display = [
        'title',
        'date_created',
        'date_updated'
    ]
admin.site.register(Post, PostAdmin)
<file_sep>from django.shortcuts import render
from django.http import HttpResponse
from .models import Post
# Create your views here.

def home(request):
    #Get all posts
    all_posts = Post.objects.all()
    return render(request, 'blog/home.html', {'posts' : all_posts})

def post_detail(request, id):
    # Get only one post
    single_post = Post.objects.get(pk=id)
    return render(request, 'blog/post-detail.html', {'post': single_post})

def about(request):
    return render(request, 'blog/about.html')
