Fix problem and contest clone
This commit is contained in:
parent
ac2fd3dfe0
commit
4b0de87f1e
2 changed files with 13 additions and 10 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
from copy import deepcopy
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
from calendar import Calendar, SUNDAY
|
from calendar import Calendar, SUNDAY
|
||||||
|
@ -417,13 +418,13 @@ class ContestClone(
|
||||||
permission_required = "judge.clone_contest"
|
permission_required = "judge.clone_contest"
|
||||||
|
|
||||||
def form_valid(self, form):
|
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()
|
contest = deepcopy(self.object)
|
||||||
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.pk = None
|
contest.pk = None
|
||||||
contest.is_visible = False
|
contest.is_visible = False
|
||||||
|
|
|
@ -5,6 +5,7 @@ from datetime import timedelta, datetime
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from random import randrange
|
from random import randrange
|
||||||
import random
|
import random
|
||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
@ -1183,11 +1184,12 @@ class ProblemClone(
|
||||||
permission_required = "judge.clone_problem"
|
permission_required = "judge.clone_problem"
|
||||||
|
|
||||||
def form_valid(self, form):
|
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.pk = None
|
||||||
problem.is_public = False
|
problem.is_public = False
|
||||||
problem.ac_rate = 0
|
problem.ac_rate = 0
|
||||||
|
|
Loading…
Reference in a new issue