Answers for "how to delete all instances of a model in django"

0

how to delete all instances of a model in django

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)
Posted by: Guest on June-26-2021

Code answers related to "how to delete all instances of a model in django"

Python Answers by Framework

Browse Popular Code Answers by Language