码迷,mamicode.com
首页 > 其他好文 > 详细

Part 2 - Fundamentals(4-10)

时间:2018-09-06 14:29:23      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:sql   targe   name   class   his   lex   migrate   desc   djang   

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)

 

Part 2 - Fundamentals(4-10)

标签:sql   targe   name   class   his   lex   migrate   desc   djang   

原文地址:https://www.cnblogs.com/larken/p/9597716.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!