Part 6 - Class-Based Views(21-26)
https://github.com/sibtc/django-beginners-guide/tree/v0.6-lw
urlpatterns = [ views.PostUpdateView.as_view(), name='edit_post'), ]
python manage.py makemigrations python manage.py sqlmigrate boards 0001 python manage.py migrate python manage.py shell from boards.models import Board board = Board.objects.create(name='Django', description='This is a board about Django.') board = Board.objects.create(name='Python', description='General discussion about Python.') board = Board.objects.create(name='Random', description='Here you can discuss about anything.') boards_list = Board.objects.all() for board in boards_list: print(board.description)
from django.contrib.auth.models import User from boards.models import Board, Topic, Post user = User.objects.first() board = Board.objects.get(name='Django') for i in range(100): subject = 'Topic test #{}'.format(i) topic = Topic.objects.create(subject=subject, board=board, starter=user) Post.objects.create(message='Lorem ipsum...', topic=topic, created_by=user)