On Thu, 2007-04-26 at 07:21 -0700, [EMAIL PROTECTED] wrote: > Hello, > > I have a small photo gallery application. My model has two classes, > Gallery and Photo. Gallery contains information on the width and > height of the thumbnails of its photos. I added a post_save signal so > that when a Gallery object is saved, all the photo thumbnails are > recreated to match the specified width and height. This means that > changing information unrelated to the thumbnails recreates them. > > I would like to know if it's possible to find which fields have been > update so that I could resize the thumbnails only when the width or > height attributes have been changed. Is that possible?
You would need to requery the database at the start of your save method and compare the values you are about to save to the values in the version you just retrieved from the database. There's no way to have this sort of detection happen automatically, because it's not information that a database will provide. If you tell it to update to a new value it does just that, it doesn't also say "and by the way, here's the value I'm replacing". So the extra query each time is necessary. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---