Cart 0

Python Django-the Practical Guide Page

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

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

class PostCreateView(CreateView): model = Post fields = ['title', 'content'] success_url = '/'

CBVs reduce code repetition significantly. blog/tests.py