Django Tutorial · Django Tutorial

Django Delete Data

Learn all about Django Delete Data in this comprehensive tutorial.

5 min read intermediate
  • To delete a record in a table, start by getting the record you want to delete:

Delete Records

To delete a record in a table, start by getting the record you want to delete:

python

x will now represent the member at index 5, which is "Jane Doe", but to make sure, let us see if that is correct:

python

This should give you this result:

python

Now we can delete the record:

python

The result will be:

python

Which tells us how many items were deleted, and from which Model.

If we look at the Member Model, we can see that 'Jane Doe' is removed from the Model:

python

Module quiz

2 questions
1

Which of the following is true about Django Delete Data?

2

What is the most common pitfall when working with Django Delete Data?

Answer all questions to submit.