On Jan 7, 2009, at 9:32 PM, dmishe wrote:
> > Hey. > > I have FielField in my model for user to upload ZIP-archives. I want > to unpack that zip, place some files in some dirs and delete it just > after user uploaded it in admin. > > How can i do this? Model's save won't work because it gets called > everytime model is saved regardless of were the file uploaded again or > not. Custom storage/upload handler seems too complicated for this. A common way to check if an object is getting saved for the first time or not is to check if it has a pk. A newly created object won't have a pk until you call the super save() method, so you can put whatever operations you want to conduct inside an "if not obj.pk:" block. See if that does what you want... Eric > > > > --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---