On Sunday, March 4, 2012 3:12:20 PM UTC+2, Nikhil Verma wrote: > > Hi akaariai > > As you said i will remove the file and leave the file in file > system(mistake for writing delete). > Now what i have done is :- > > image: Currently: > images/testimonial-bottom_2.png<http://localhost:8000/media/images/testimonial-bottom_2.png> > > Change: Delete this file > > When you click the link Delete this file what it will do is it will remove > the path > "images/testimonial-bottom_2.png<http://localhost:8000/media/images/testimonial-bottom_2.png>".But > the problem begins when you press save button and open the same row > in django - admin it appears again as if it was not removed and actually it > is not removed from that ImageField . i have checked by going through shell. > > Actually i want implement ImageField of Django1.4b . It has a > checkbox(remove_image) along with the ImageField asking for clear image and > when you click on that the image get removed. How can i get the same thing > working for Django1.2.5 which i am using. > > One way is to check the source code of 1.4b and see what it does.
> So i thought to make a checkbox ,click on that it will trigger a post_save > signal which first looks if the checkbox of remove_image is checked and > when save button is pressed it wil remove the path of image. > > How can i implement that ? Thanks for help in advance . > > I have a bit hard time following what is the exact thing you want. So, the best advice I can give you is this: don't use the post_save signal. Use pre_save signal or better yet, a custom ModelForm. You must do the clearing of the image field _before_ the data gets saved into the database, and you can't do that from post_save signal. - Anssi -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ORkjtr8LBHoJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.