📜  如何在 django 中删除模型的所有实例 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:09.284000             🧑  作者: Mango

代码示例1
from django.shortcuts import render
from .models import Car

def showthis(request):
    #deletes all objects from Car database table
    Car.objects.all().delete()
    context= {}    
    return render(request, 'Blog/home.html', context)