I try to open the uploaded file in model In these situations, I'm sth ... like this ... clean_fields () , Doing / doing
class.model: attach = models.fileField (upload_to = 'attach') DRF clean_fields (self, expelled = True): f = open (self.attach.path , 'Rb') The problem is that before model
save () , self.attach.path is actually wrong
upload_to
self.attach.path is present and true after model's
save () < P> How do I verify the content of an uploaded file in the
clean_fields () process? I want to increase the assumptions, not error after saving the model.
def save (self, * args, ** kwargs): super (gallery, self). Save (* Args, ** kwargs) Gallery = self.process_control () Super (Gallery, Auto) .delete () Return Gallery
Comments
Post a Comment