Fix problem code change bug

This commit is contained in:
cuom1999 2023-10-27 18:02:02 -05:00
parent b053c43b19
commit 7a05ad1c3b
6 changed files with 23 additions and 8 deletions

View file

@ -556,7 +556,7 @@ class Problem(models.Model, PageVotable, Bookmarkable):
def save(self, *args, **kwargs):
super(Problem, self).save(*args, **kwargs)
if self.code != self.__original_code:
if self.__original_code and self.code != self.__original_code:
if hasattr(self, "data_files") or self.pdf_description:
try:
problem_data_storage.rename(self.__original_code, self.code)