How to filter and delete object in django model delete()
In this post, we'll learn how to filter and delete objects in Django.
1. filtring and deleting an object using delete()
#models.py class test(models.Model): firstname = models.CharField(max_length=300) last_name = models.CharField(max_length=300)
First, let's create an object and saving it.
Now, we'll get all objects that contain "mark" as firstname and delete them.
2. Deleting all objects
Deleting all Objects in test model.
English today is not an art to be mastered it's just a tool to use to get a result