And sorry if my question was already asked on SO but I could not find the answer I’m looking for.
I created a Model with an ImageField and a DateField. In my django automatic admin (django 1.4), I have the corresponding ModelAdmin: I’d like to set the date from the image when the ImageField is populated by the user. To sum it up, I’d like to get the hand when the ImageField was chosen, for instance by overriding a kind of post-choice method.
How can I do that ? I could read in django doc that a clean method exists but the way/time it’s called is unclear to me.
Thanks for your help !
You can override model’s
save()method or better usepre_savesignal. Inside you can check if the object has an image but doesn’t have a date, and set the date todatetime.datetime.now().