Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
 
PREVIOUS NEXT
Tagged: #delete #instances #model #django
ADD COMMENT
Topic
Name
7+6 =