mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-12-29 00:22:03 +00:00
isort
This commit is contained in:
parent
cfde5b93e5
commit
d9fad97e35
@ -1,9 +1,9 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from utils.api import JSONResponse
|
from utils.api import JSONResponse
|
||||||
|
|
||||||
from .models import AdminType
|
from .models import AdminType
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import time
|
import time
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
from django.contrib import auth
|
from django.contrib import auth
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from utils.api import JSONResponse
|
from utils.api import JSONResponse
|
||||||
|
|
||||||
from .models import AdminType
|
from .models import AdminType
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
# Generated by Django 1.9.12 on 2017-01-23 07:59
|
# Generated by Django 1.9.12 on 2017-01-23 07:59
|
||||||
from __future__ import unicode_literals
|
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 django.db.models.deletion
|
||||||
import jsonfield.fields
|
import jsonfield.fields
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import account.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
@ -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):
|
class UserLoginSerializer(serializers.Serializer):
|
||||||
|
@ -3,12 +3,12 @@ from unittest import mock
|
|||||||
|
|
||||||
from django.contrib import auth
|
from django.contrib import auth
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from otpauth import OtpAuth
|
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):
|
class PermissionDecoratorTest(APITestCase):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from ..views.oj import UserLoginAPI, UserRegisterAPI, UserChangePasswordAPI
|
from ..views.oj import UserChangePasswordAPI, UserLoginAPI, UserRegisterAPI
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r"^login$", UserLoginAPI.as_view(), name="user_login_api"),
|
url(r"^login$", UserLoginAPI.as_view(), name="user_login_api"),
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.core.exceptions import MultipleObjectsReturned
|
from django.core.exceptions import MultipleObjectsReturned
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
@ -9,7 +7,7 @@ from utils.shortcuts import rand_str
|
|||||||
|
|
||||||
from ..decorators import super_admin_required
|
from ..decorators import super_admin_required
|
||||||
from ..models import User
|
from ..models import User
|
||||||
from ..serializers import (UserSerializer, EditUserSerializer)
|
from ..serializers import EditUserSerializer, UserSerializer
|
||||||
|
|
||||||
|
|
||||||
class UserAdminAPI(APIView):
|
class UserAdminAPI(APIView):
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
from django.contrib import auth
|
from django.contrib import auth
|
||||||
from django.core.exceptions import MultipleObjectsReturned
|
from django.core.exceptions import MultipleObjectsReturned
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from otpauth import OtpAuth
|
from otpauth import OtpAuth
|
||||||
|
|
||||||
from utils.api import APIView, validate_serializer
|
from utils.api import APIView, validate_serializer
|
||||||
from utils.captcha import Captcha
|
from utils.captcha import Captcha
|
||||||
|
|
||||||
from ..decorators import login_required
|
from ..decorators import login_required
|
||||||
from ..models import User, UserProfile
|
from ..models import User, UserProfile
|
||||||
from ..serializers import (UserLoginSerializer, UserRegisterSerializer,
|
from ..serializers import (UserChangePasswordSerializer, UserLoginSerializer,
|
||||||
UserChangePasswordSerializer)
|
UserRegisterSerializer)
|
||||||
|
|
||||||
|
|
||||||
class UserLoginAPI(APIView):
|
class UserLoginAPI(APIView):
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
# Generated by Django 1.9.12 on 2017-01-23 07:59
|
# Generated by Django 1.9.12 on 2017-01-23 07:59
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
import utils.models
|
import utils.models
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from utils.api import serializers
|
|
||||||
|
|
||||||
from account.models import User
|
from account.models import User
|
||||||
|
from utils.api import serializers
|
||||||
from utils.api._serializers import DateTimeTZField
|
from utils.api._serializers import DateTimeTZField
|
||||||
|
|
||||||
from .models import Announcement
|
from .models import Announcement
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from account.decorators import super_admin_required
|
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 .models import Announcement
|
||||||
from .serializers import (CreateAnnouncementSerializer, AnnouncementSerializer,
|
from .serializers import (AnnouncementSerializer, CreateAnnouncementSerializer,
|
||||||
EditAnnouncementSerializer)
|
EditAnnouncementSerializer)
|
||||||
|
|
||||||
|
|
||||||
|
@ -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):
|
class EditSMTPConfigSerializer(serializers.Serializer):
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from utils.api.tests import APITestCase
|
from utils.api.tests import APITestCase
|
||||||
from .models import SMTPConfig, JudgeServerToken, JudgeServer
|
|
||||||
|
from .models import JudgeServer, JudgeServerToken, SMTPConfig
|
||||||
|
|
||||||
|
|
||||||
class SMTPConfigTest(APITestCase):
|
class SMTPConfigTest(APITestCase):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from ..views import WebsiteConfigAPI, SMTPAPI, JudgeServerAPI
|
from ..views import SMTPAPI, JudgeServerAPI, WebsiteConfigAPI
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r"^smtp$", SMTPAPI.as_view(), name="smtp_admin_api"),
|
url(r"^smtp$", SMTPAPI.as_view(), name="smtp_admin_api"),
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from ..views import WebsiteConfigAPI, JudgeServerHeartbeatAPI
|
from ..views import JudgeServerHeartbeatAPI, WebsiteConfigAPI
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r"^website$", WebsiteConfigAPI.as_view(), name="website_info_api"),
|
url(r"^website$", WebsiteConfigAPI.as_view(), name="website_info_api"),
|
||||||
|
@ -6,11 +6,12 @@ from account.decorators import super_admin_required
|
|||||||
from utils.api import APIView, CSRFExemptAPIView, validate_serializer
|
from utils.api import APIView, CSRFExemptAPIView, validate_serializer
|
||||||
from utils.shortcuts import rand_str
|
from utils.shortcuts import rand_str
|
||||||
|
|
||||||
from .models import SMTPConfig, WebsiteConfig, JudgeServer, JudgeServerToken
|
from .models import JudgeServer, JudgeServerToken, SMTPConfig, WebsiteConfig
|
||||||
from .serializers import (WebsiteConfigSerializer, CreateEditWebsiteConfigSerializer,
|
from .serializers import (CreateEditWebsiteConfigSerializer,
|
||||||
CreateSMTPConfigSerializer, EditSMTPConfigSerializer,
|
CreateSMTPConfigSerializer, EditSMTPConfigSerializer,
|
||||||
SMTPConfigSerializer, TestSMTPConfigSerializer,
|
JudgeServerHeartbeatSerializer,
|
||||||
JudgeServerSerializer, JudgeServerHeartbeatSerializer)
|
JudgeServerSerializer, SMTPConfigSerializer,
|
||||||
|
TestSMTPConfigSerializer, WebsiteConfigSerializer)
|
||||||
|
|
||||||
|
|
||||||
class SMTPAPI(APIView):
|
class SMTPAPI(APIView):
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from group.models import Group
|
|
||||||
from jsonfield import JSONField
|
from jsonfield import JSONField
|
||||||
|
|
||||||
from account.models import User
|
from account.models import User
|
||||||
|
from group.models import Group
|
||||||
from problem.models import AbstractProblem
|
from problem.models import AbstractProblem
|
||||||
from utils.models import RichTextField
|
from utils.models import RichTextField
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from __future__ import unicode_literals
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -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/')]
|
OJ_TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/src/')]
|
||||||
|
|
||||||
|
@ -46,5 +46,3 @@ STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/release/")]
|
|||||||
|
|
||||||
# 模板文件夹
|
# 模板文件夹
|
||||||
OJ_TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/release/')]
|
OJ_TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'template/release/')]
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,10 +10,11 @@ https://docs.djangoproject.com/en/1.8/topics/settings/
|
|||||||
For the full list of settings and their values, see
|
For the full list of settings and their values, see
|
||||||
https://docs.djangoproject.com/en/1.8/ref/settings/
|
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, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from .custom_settings import *
|
||||||
|
|
||||||
# 判断运行环境
|
# 判断运行环境
|
||||||
ENV = os.environ.get("oj_env", "local")
|
ENV = os.environ.get("oj_env", "local")
|
||||||
|
|
||||||
@ -22,7 +23,6 @@ if ENV == "local":
|
|||||||
elif ENV == "server":
|
elif ENV == "server":
|
||||||
from .server_settings import *
|
from .server_settings import *
|
||||||
|
|
||||||
from .custom_settings import *
|
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from jsonfield import JSONField
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from jsonfield import JSONField
|
||||||
|
|
||||||
from account.models import User
|
from account.models import User
|
||||||
from utils.models import RichTextField
|
from utils.models import RichTextField
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
|
import functools
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import functools
|
|
||||||
|
|
||||||
from django.http import HttpResponse, QueryDict
|
from django.http import HttpResponse, QueryDict
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
from django.test.testcases import TestCase
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.test.testcases import TestCase
|
||||||
from rest_framework.test import APIClient
|
from rest_framework.test import APIClient
|
||||||
|
|
||||||
from account.models import User, AdminType
|
from account.models import AdminType, User
|
||||||
|
|
||||||
|
|
||||||
class APITestCase(TestCase):
|
class APITestCase(TestCase):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from django.core.management.base import BaseCommand
|
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):
|
class Command(BaseCommand):
|
||||||
|
@ -3,7 +3,6 @@ import random
|
|||||||
|
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user