diff --git a/oioioi/contests/admin.py b/oioioi/contests/admin.py index e9ba94d90..26bd4d3ee 100644 --- a/oioioi/contests/admin.py +++ b/oioioi/contests/admin.py @@ -2,7 +2,7 @@ import urllib from django.contrib.admin import AllValuesFieldListFilter, SimpleListFilter -from django.contrib.admin.util import unquote +from django.contrib.admin.util import unquote, quote from django.core.urlresolvers import reverse from django.forms.models import modelform_factory from django.http import HttpResponseRedirect @@ -135,7 +135,7 @@ def _mixins_for_instance(self, request, instance): contest_admin_menu_registry.register('contest_change', _("Settings"), lambda request: reverse('oioioiadmin:contests_contest_change', - args=(request.contest.id,)), order=20) + args=(quote(request.contest.id),)), order=20) class ProblemInstanceAdmin(admin.ModelAdmin): diff --git a/oioioi/contests/tests.py b/oioioi/contests/tests.py index 1e1e22314..b08f1f5b6 100644 --- a/oioioi/contests/tests.py +++ b/oioioi/contests/tests.py @@ -11,6 +11,7 @@ from django.core.files.base import ContentFile from django.utils.timezone import utc, LocalTimezone from django.contrib.auth.models import User, AnonymousUser +from django.contrib.admin.util import quote from oioioi.base.tests import check_not_accessible, fake_time from oioioi.contests.models import Contest, Round, ProblemInstance, \ @@ -491,8 +492,8 @@ def test_simple_contest_create_and_change(self): self.assertEqual(round.results_date, datetime(2012, 2, 5, 6, 7, 8, tzinfo=LocalTimezone())) - url = reverse('oioioiadmin:contests_contest_change', args=('cid',)) \ - + '?simple=true' + url = reverse('oioioiadmin:contests_contest_change', + args=(quote('cid'),)) + '?simple=true' response = self.client.get(url) self.assertIn('2012-02-05', response.content) self.assertIn('06:07:08', response.content) @@ -521,8 +522,8 @@ def test_simple_contest_create_and_change(self): self.assertEqual(round.results_date, datetime(2013, 2, 5, 16, 7, 8, tzinfo=LocalTimezone())) - url = reverse('oioioiadmin:contests_contest_change', args=('cid',)) \ - + '?simple=true' + url = reverse('oioioiadmin:contests_contest_change', + args=(quote('cid'),)) + '?simple=true' response = self.client.get(url) post_data = { 'name': 'cname1',