Part 5 - Django ORM(17-20)
https://github.com/sibtc/django-beginners-guide/tree/v0.5-lw
from django.conf.urls import url from django.contrib import admin from django.contrib.auth import views as auth_views from accounts import views as accounts_views from boards import views urlpatterns = [ url(r'^$', views.home, name='home'), url(r'^signup/$', accounts_views.signup, name='signup'), url(r'^login/$', auth_views.LoginView.as_view(template_name='login.html'), name='login'), url(r'^logout/$', auth_views.LogoutView.as_view(), name='logout'), url(r'^boards/(?P<pk>\d+)/$', views.board_topics, name='board_topics'), url(r'^boards/(?P<pk>\d+)/new/$', views.new_topic, name='new_topic'), url(r'^boards/(?P<pk>\d+)/topics/(?P<topic_pk>\d+)/$', views.topic_posts, name='topic_posts'), url(r'^boards/(?P<pk>\d+)/topics/(?P<topic_pk>\d+)/reply/$', views.reply_topic, name='reply_topic'), url(r'^admin/', admin.site.urls), ]
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)