Django ImageFieldFile 设置为 <ImageFieldFile: null>。如何将其更改为 blank/empty,就像 table 中的其他条目一样?

Django ImageFieldFile set to <ImageFieldFile: null>. How to change it to blank/empty, like other entries in the table?

我在 Django 模型中有一个 FileField。此 FileField 中的某些条目设置为 <ImageFieldFile: null>。 模型的其余部分 table 是空白或实际图像。我需要清理这个 table 以便这些错误条目也更改为空白,因为这不是我的 DRF API.

中的 acceptable

获取所有图片实例。

objs =myclassmodel.objects.all() //just assuming this
for obj in objs:
    obj.image = ""
    obj.save()

你理解对了就可以了