larken

勤奋的人生才有价值

导航

Part 2 - Fundamentals(4-10)

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(name='Django', description='This is a board about Django.')
board.save()
board = Board.objects.create(name='Python', description='General discussion about Python.')

boards_list = Board.objects.all()
for board in boards_list:
    print(board.description)
from django.conf.urls import url
from django.contrib import admin
from boards import views

urlpatterns = [
    url(r'^$', views.home, name='home'),
    url(r'^admin/', admin.site.urls),
]
from django.contrib import admin
from .models import Board

admin.site.register(Board)

 

posted on 2018-09-06 19:01  larken  阅读(133)  评论(0编辑  收藏  举报