From 4756f86290426b5af8878500cf1bfd05e81f528e Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 15 Apr 2021 13:33:39 +0530 Subject: Change in views, models, test views - Remove unnecessary model methods - Fix issue in design question paper for undefined variable error - Fix views test to remove lesson files --- yaksh/models.py | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 7686aa0..fd48318 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -391,13 +391,6 @@ class LessonFile(models.Model): on_delete=models.CASCADE) file = models.FileField(upload_to=get_file_dir, default=None) - def remove(self): - if os.path.exists(self.file.path): - os.remove(self.file.path) - if os.listdir(os.path.dirname(self.file.path)) == []: - os.rmdir(os.path.dirname(self.file.path)) - self.delete() - pre_delete.connect(file_cleanup, sender=LessonFile) ############################################################################### @@ -1695,13 +1688,6 @@ class FileUpload(models.Model): extract = models.BooleanField(default=False) hide = models.BooleanField(default=False) - def remove(self): - if os.path.exists(self.file.path): - os.remove(self.file.path) - if os.listdir(os.path.dirname(self.file.path)) == []: - os.rmdir(os.path.dirname(self.file.path)) - self.delete() - def set_extract_status(self): if self.extract: self.extract = False -- cgit