Пример #1
0
 def delete(self, **kwargs):
     # delete files:
     for name in (
         self.image.path, self.image.thumb_path, 
         ):
         remove_file(name)
     super(AbstractImage, self).delete(**kwargs)
Пример #2
0
 def save(self):
     self.label = self.label or self.get_default_label()
     if self.id:
         try:
             presave_obj = self.__class__.objects.get(id=self.id)
         except:
             pass
         else:
             try:
                 presave_obj.file.path
             except:
                 pass
             else:
                 if self.file != presave_obj.file:
                     remove_file(presave_obj.file.path)
     super(AbstractFile, self).save()
Пример #3
0
 def save(self, **kwargs):
     if self.id:
         try:
             presave_obj = self.__class__.objects.get(id=self.id)
         except:
             pass
         else:
             try:
                 presave_obj.image.path
             except:
                 pass
             else:
                 if self.image != presave_obj.image:
                     # delete old image files:
                     for name in (
                         presave_obj.image.path, presave_obj.image.thumb_path, 
                         ):
                         remove_file(name)
     super(AbstractImage, self).save(**kwargs)
Пример #4
0
 def delete(self):
     remove_file(self.file.path)
     remove_dirs(os.path.dirname(self.file.path))
     super(Report, self).delete()
Пример #5
0
 def delete(self):
     remove_file(self.file.path)
     super(AbstractFile, self).delete()