Django:数据库查询写入

写入新的记录:

from movie.models import Movie
...
m = Movie()
m.XXX = XXX
m.save()

查询记录:

m = Movie.objects.get(name=i.name,site=i.site)
m = Movie.objects.get(name=i.name,site=i.site)

条件查询,QuerySet API reference

items = Movie.objects.filter()
items = Movie.objects.filter().order_by('name')

results matching ""

    No results matching ""