imgfield.storage.save(name, content)
if not created:
spec_file._delete()
spec_file._create()
def _post_delete_handler(sender, instance=None, **kwargs):
assert instance._get_pk_val() is not None, "%s object can"t be deleted because its %s attribute is set to None." % (instance._meta.object_name, instance._meta.pk.attname)
After Change
for spec_file in spec_files:
if not created:
spec_file._delete()
if spec_file.field.pre_cache:
spec_file._create()
def _post_delete_handler(sender, instance=None, **kwargs):
assert instance._get_pk_val() is not None, "%s object can"t be deleted because its %s attribute is set to None." % (instance._meta.object_name, instance._meta.pk.attname)
spec_files = get_spec_files(instance)
for spec_file in spec_files: