diff --git a/judge/models/problem.py b/judge/models/problem.py index b0189db..6625fab 100644 --- a/judge/models/problem.py +++ b/judge/models/problem.py @@ -556,10 +556,10 @@ class Problem(models.Model, PageVotable, Bookmarkable): cache.set(key, result) return result - def save(self, *args, **kwargs): + def save(self, should_move_data=True, *args, **kwargs): code_changed = self.__original_code and self.code != self.__original_code super(Problem, self).save(*args, **kwargs) - if code_changed: + if code_changed and should_move_data: if hasattr(self, "data_files") or self.pdf_description: try: problem_data_storage.rename(self.__original_code, self.code) diff --git a/judge/views/problem.py b/judge/views/problem.py index 3b7cd84..b69c3e3 100644 --- a/judge/views/problem.py +++ b/judge/views/problem.py @@ -1186,7 +1186,7 @@ class ProblemClone( problem.ac_rate = 0 problem.user_count = 0 problem.code = form.cleaned_data["code"] - problem.save() + problem.save(should_move_data=False) problem.authors.add(self.request.profile) problem.allowed_languages.set(languages) problem.language_limits.set(language_limits)