Reputation: 7318
@receiver(pre_save, sender=Document, dispatch_uid='question_save_signal')
def log_save_question(sender, instance, using, **kwargs):
p = instance
Here is the code I use to intercept saving in django admin. From inside this function, I would need to access request.FILES to access new files that were just selected in an ImageField and are being submitted. How would you do it ?
Upvotes: 2
Views: 315
Reputation: 2539
When you have a pre_save function, the properties are already set to the object, however it is not saved to the db yet.
So if your Document Model has an attribute image
, you should be able to access it through: instance.image
Upvotes: 1