how to delete all instances of a model in django

Solutions on MaxInterview for how to delete all instances of a model in django by the best coders in the world

showing results for - "how to delete all instances of a model in django"
Matys
14 Apr 2019
1from django.shortcuts import render
2from .models import Car
3
4def showthis(request):
5    #deletes all objects from Car database table
6    Car.objects.all().delete()
7    context= {}    
8    return render(request, 'Blog/home.html', context)
9