3👍
✅
The queryset delete method (e.g. File.objects.filter(...).delete()
) returns a tuple.
When you delete an instance (e.g. instance.delete()
) it returns None
.
I’m not sure what you mean by ‘when I check the file list, no file is gone’. Note that when you delete a model instance, it will remove the row from the database. If the model has a FileField
, it won’t automatically delete the associated file.
3👍
I had a similar problem (that’s how I found this), and I think if you simply put a ‘/’ in the end of the URL for delete, it should work. At least thats what worked with me.
...
url(r'^(?P<slug>[\w-]+)/(?P<pk>\d+)/delete/<<<<$', views.file_delete, name="file_delete"),
]
Source:stackexchange.com