django中数据库基本操作:
1.同步数据库
python manage.py makemigrations #生成migrations
python manage.py migrate #应用migrations
2.增
Model.objects.create(**kwargs)
3.查
Model.objects.all()
4.改
m = Model.objects.get(id=1)
m.name = ‘new_name‘
m.save()
5.删
m = Model.objects.get(id=1)
m.delete()
原文:https://www.cnblogs.com/jj1106/p/11017080.html