This commit is contained in:
virusdefender 2017-01-23 16:48:04 +08:00
parent cfde5b93e5
commit d9fad97e35
27 changed files with 46 additions and 52 deletions

View File

@ -1,9 +1,9 @@
from __future__ import unicode_literals
import functools
from django.utils.translation import ugettext as _
from utils.api import JSONResponse
from .models import AdminType

View File

@ -1,8 +1,10 @@
import time
from django.utils.translation import ugettext as _
from django.contrib import auth
from django.utils.translation import ugettext as _
from utils.api import JSONResponse
from .models import AdminType

View File

@ -2,11 +2,12 @@
# Generated by Django 1.9.12 on 2017-01-23 07:59
from __future__ import unicode_literals
import account.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
from django.conf import settings
from django.db import migrations, models
import account.models
class Migration(migrations.Migration):

View File

@ -1,6 +1,6 @@
from utils.api import serializers, DateTimeTZField
from utils.api import DateTimeTZField, serializers
from .models import User, AdminType
from .models import AdminType, User
class UserLoginSerializer(serializers.Serializer):

View File

@ -3,12 +3,12 @@ from unittest import mock
from django.contrib import auth
from django.utils.translation import ugettext as _
from otpauth import OtpAuth
from utils.shortcuts import rand_str
from utils.api.tests import APITestCase, APIClient
from .models import User, AdminType
from utils.api.tests import APIClient, APITestCase
from utils.shortcuts import rand_str
from .models import AdminType, User
class PermissionDecoratorTest(APITestCase):

View File

@ -1,6 +1,6 @@
from django.conf.urls import url
from ..views.oj import UserLoginAPI, UserRegisterAPI, UserChangePasswordAPI
from ..views.oj import UserChangePasswordAPI, UserLoginAPI, UserRegisterAPI
urlpatterns = [
url(r"^login$", UserLoginAPI.as_view(), name="user_login_api"),

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
from django.core.exceptions import MultipleObjectsReturned
from django.db.models import Q
from django.utils.translation import ugettext as _
@ -9,7 +7,7 @@ from utils.shortcuts import rand_str
from ..decorators import super_admin_required
from ..models import User
from ..serializers import (UserSerializer, EditUserSerializer)
from ..serializers import EditUserSerializer, UserSerializer
class UserAdminAPI(APIView):

View File

@ -1,15 +1,15 @@
from django.contrib import auth
from django.core.exceptions import MultipleObjectsReturned
from django.utils.translation import ugettext as _
from otpauth import OtpAuth
from utils.api import APIView, validate_serializer
from utils.captcha import Captcha
from ..decorators import login_required
from ..models import User, UserProfile
from ..serializers import (UserLoginSerializer, UserRegisterSerializer,
UserChangePasswordSerializer)
from ..serializers import (UserChangePasswordSerializer, UserLoginSerializer,
UserRegisterSerializer)
class UserLoginAPI(APIView):

View File

@ -2,9 +2,10 @@
# Generated by Django 1.9.12 on 2017-01-23 07:59
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import utils.models

View File

@ -1,7 +1,7 @@
from utils.api import serializers
from account.models import User
from utils.api import serializers
from utils.api._serializers import DateTimeTZField
from .models import Announcement

View File

@ -1,10 +1,10 @@
from django.utils.translation import ugettext as _
from account.decorators import super_admin_required
from utils.api import APIView, validate_serializer, IDOnlySerializer
from utils.api import APIView, IDOnlySerializer, validate_serializer
from .models import Announcement
from .serializers import (CreateAnnouncementSerializer, AnnouncementSerializer,
from .serializers import (AnnouncementSerializer, CreateAnnouncementSerializer,
EditAnnouncementSerializer)

View File

@ -1,6 +1,6 @@
from utils.api import serializers, DateTimeTZField
from utils.api import DateTimeTZField, serializers
from .models import SMTPConfig, WebsiteConfig, JudgeServer
from .models import JudgeServer, SMTPConfig, WebsiteConfig
class EditSMTPConfigSerializer(serializers.Serializer):

View File

@ -1,7 +1,8 @@
import hashlib
from utils.api.tests import APITestCase
from .models import SMTPConfig, JudgeServerToken, JudgeServer
from .models import JudgeServer, JudgeServerToken, SMTPConfig
class SMTPConfigTest(APITestCase):

View File

@ -1,6 +1,6 @@
from django.conf.urls import url
from ..views import WebsiteConfigAPI, SMTPAPI, JudgeServerAPI
from ..views import SMTPAPI, JudgeServerAPI, WebsiteConfigAPI
urlpatterns = [
url(r"^smtp$", SMTPAPI.as_view(), name="smtp_admin_api"),

View File

@ -1,7 +1,6 @@
from django.conf.urls import url
from ..views import WebsiteConfigAPI, JudgeServerHeartbeatAPI
from ..views import JudgeServerHeartbeatAPI, WebsiteConfigAPI
urlpatterns = [
url(r"^website$", WebsiteConfigAPI.as_view(), name="website_info_api"),

View File

@ -6,11 +6,12 @@ from account.decorators import super_admin_required
from utils.api import APIView, CSRFExemptAPIView, validate_serializer
from utils.shortcuts import rand_str
from .models import SMTPConfig, WebsiteConfig, JudgeServer, JudgeServerToken
from .serializers import (WebsiteConfigSerializer, CreateEditWebsiteConfigSerializer,
from .models import JudgeServer, JudgeServerToken, SMTPConfig, WebsiteConfig
from .serializers import (CreateEditWebsiteConfigSerializer,
CreateSMTPConfigSerializer, EditSMTPConfigSerializer,
SMTPConfigSerializer, TestSMTPConfigSerializer,
JudgeServerSerializer, JudgeServerHeartbeatSerializer)
JudgeServerHeartbeatSerializer,
JudgeServerSerializer, SMTPConfigSerializer,
TestSMTPConfigSerializer, WebsiteConfigSerializer)
class SMTPAPI(APIView):

View File

@ -1,9 +1,9 @@
from django.db import models
from django.utils.timezone import now
from group.models import Group
from jsonfield import JSONField
from account.models import User
from group.models import Group
from problem.models import AbstractProblem
from utils.models import RichTextField

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python
from __future__ import unicode_literals
import os
import sys

View File

@ -37,4 +37,3 @@ STATICFILES_DIRS = [os.path.join(BASE_DIR, "frontend/static/"), BASE_DIR]
# 模板文件夹
OJ_TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/src/')]

View File

@ -46,5 +46,3 @@ STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/release/")]
# 模板文件夹
OJ_TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/release/')]

View File

@ -10,10 +10,11 @@ https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
from __future__ import absolute_import
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from .custom_settings import *
# 判断运行环境
ENV = os.environ.get("oj_env", "local")
@ -22,7 +23,6 @@ if ENV == "local":
elif ENV == "server":
from .server_settings import *
from .custom_settings import *
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

View File

@ -1,7 +1,5 @@
from __future__ import unicode_literals
from jsonfield import JSONField
from django.db import models
from jsonfield import JSONField
from account.models import User
from utils.models import RichTextField

View File

@ -1,7 +1,6 @@
import json
from django.utils import timezone
from rest_framework import serializers

View File

@ -1,13 +1,12 @@
import functools
import json
import logging
import functools
from django.http import HttpResponse, QueryDict
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
logger = logging.getLogger(__name__)

View File

@ -1,9 +1,8 @@
from django.test.testcases import TestCase
from django.core.urlresolvers import reverse
from django.test.testcases import TestCase
from rest_framework.test import APIClient
from account.models import User, AdminType
from account.models import AdminType, User
class APITestCase(TestCase):

View File

@ -1,6 +1,7 @@
from django.core.management.base import BaseCommand
from account.models import User, UserProfile, AdminType
from utils.shortcuts import rand_str
from account.models import AdminType, User, UserProfile
from utils.shortcuts import rand_str # NOQA
class Command(BaseCommand):

View File

@ -3,7 +3,6 @@ import random
from django.utils.crypto import get_random_string
logger = logging.getLogger(__name__)