Fix problem and contest clone

This commit is contained in:
cuom1999 2022-11-07 15:39:10 -06:00
parent ac2fd3dfe0
commit 4b0de87f1e
2 changed files with 13 additions and 10 deletions

View file

@ -1,3 +1,4 @@
from copy import deepcopy
import json
import math
from calendar import Calendar, SUNDAY
@ -417,13 +418,13 @@ class ContestClone(
permission_required = "judge.clone_contest"
def form_valid(self, form):
contest = self.object
tags = self.object.tags.all()
organizations = self.object.organizations.all()
private_contestants = self.object.private_contestants.all()
view_contest_scoreboard = self.object.view_contest_scoreboard.all()
contest_problems = self.object.contest_problems.all()
tags = contest.tags.all()
organizations = contest.organizations.all()
private_contestants = contest.private_contestants.all()
view_contest_scoreboard = contest.view_contest_scoreboard.all()
contest_problems = contest.contest_problems.all()
contest = deepcopy(self.object)
contest.pk = None
contest.is_visible = False

View file

@ -5,6 +5,7 @@ from datetime import timedelta, datetime
from operator import itemgetter
from random import randrange
import random
from copy import deepcopy
from django.conf import settings
from django.contrib.auth.decorators import login_required
@ -1183,11 +1184,12 @@ class ProblemClone(
permission_required = "judge.clone_problem"
def form_valid(self, form):
problem = self.object
languages = self.object.allowed_languages.all()
language_limits = self.object.language_limits.all()
types = self.object.types.all()
problem = deepcopy(self.object)
languages = problem.allowed_languages.all()
language_limits = problem.language_limits.all()
types = problem.types.all()
problem.pk = None
problem.is_public = False
problem.ac_rate = 0