Add maintenace view to clear the document image cache

This commit is contained in:
Roberto Rosario
2011-12-01 05:24:31 -04:00
parent 13826a0a4a
commit da1ab56202
5 changed files with 31 additions and 1 deletions

View File

@@ -92,6 +92,13 @@ class Document(models.Model):
object_id_field='object_pk'
)
@staticmethod
def clear_image_cache():
for the_file in os.listdir(CACHE_PATH):
file_path = os.path.join(CACHE_PATH, the_file)
if os.path.isfile(file_path):
os.unlink(file_path)
class Meta:
verbose_name = _(u'document')
verbose_name_plural = _(u'documents')