I want to delete a particular record. Such as
delete from table_name where id = 1;
How can I do this in a django model?
There are a couple of ways:
To delete it directly:
SomeModel.objects.filter(id=id).delete()
To delete it from an instance:
instance = SomeModel.objects.get(id=id) instance.delete()
1.4m articles
1.4m replys
5 comments
57.0k users