完善contest和announcement单元测试
This commit is contained in:
@@ -98,7 +98,7 @@ def check_contest_permission(check_type="details"):
|
||||
if self.contest.status == ContestStatus.CONTEST_NOT_START and check_type != "details":
|
||||
return self.error("Contest has not started yet.")
|
||||
|
||||
# check does user have permission to get ranks, submissions OI Contest
|
||||
# check does user have permission to get ranks, submissions in OI Contest
|
||||
if self.contest.status == ContestStatus.CONTEST_UNDERWAY and self.contest.rule_type == ContestRuleType.OI:
|
||||
if not self.contest.real_time_rank and (check_type == "ranks" or check_type == "submissions"):
|
||||
return self.error(f"No permission to get {check_type}")
|
||||
|
||||
20
account/migrations/0009_auto_20171125_1514.py
Normal file
20
account/migrations/0009_auto_20171125_1514.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.4 on 2017-11-25 15:14
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('account', '0008_auto_20171011_1214'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='userprofile',
|
||||
name='avatar',
|
||||
field=models.CharField(default='/public/avatar/default.png', max_length=256),
|
||||
),
|
||||
]
|
||||
@@ -22,7 +22,7 @@ class UserAdminAPI(APIView):
|
||||
@super_admin_required
|
||||
def post(self, request):
|
||||
"""
|
||||
Generate user
|
||||
Import User
|
||||
"""
|
||||
data = request.data["users"]
|
||||
|
||||
@@ -166,6 +166,9 @@ class GenerateUserAPI(APIView):
|
||||
@validate_serializer(GenerateUserSerializer)
|
||||
@super_admin_required
|
||||
def post(self, request):
|
||||
"""
|
||||
Generate User
|
||||
"""
|
||||
data = request.data
|
||||
number_max_length = max(len(str(data["number_from"])), len(str(data["number_to"])))
|
||||
if number_max_length + len(data["prefix"]) + len(data["suffix"]) > 32:
|
||||
|
||||
Reference in New Issue
Block a user