from django.db import models class Post(models.Model): title = models.CharField(max_length=200) content = models.TextField() created_at = models.DateTimeField(auto_now_add=True)
python manage.py makemigrations python manage.py migrate python django-the practical guide
class PostCreateView(CreateView): model = Post fields = ['title', 'content'] success_url = '/' from django
CBVs reduce code repetition significantly. blog/tests.py python django-the practical guide