增加相关的常量的定义以及url参数

This commit is contained in:
virusdefender 2015-08-09 12:58:31 +08:00
parent c4b02270cb
commit 6f5c9b1657
3 changed files with 13 additions and 3 deletions

View File

@ -14,6 +14,11 @@ class UserManager(models.Manager):
return self.get(**{self.model.USERNAME_FIELD: username})
REGULAR_USER = 0
ADMIN = 1
SUPER_ADMIN = 2
class User(AbstractBaseUser):
# 用户名
username = models.CharField(max_length=30, unique=True)

View File

@ -49,6 +49,7 @@ INSTALLED_APPS = (
'account',
'announcement',
'utils',
'group',
'rest_framework',
'rest_framework_swagger',
@ -63,6 +64,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'admin.middleware.AdminRequiredMiddleware'
)
ROOT_URLCONF = 'oj.urls'

View File

@ -3,9 +3,11 @@ from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from account.views import UserLoginAPIView, UsernameCheckAPIView, UserRegisterAPIView, UserChangePasswordAPIView, \
EmailCheckAPIView, UserAPIView, UserAdminAPIView
from account.views import (UserLoginAPIView, UsernameCheckAPIView, UserRegisterAPIView,
UserChangePasswordAPIView, EmailCheckAPIView,
UserAPIView, UserAdminAPIView)
from announcement.views import AnnouncementAPIView, AnnouncementAdminAPIView
from group.views import GroupAdminAPIView
from admin.views import AdminTemplateView
urlpatterns = [
@ -29,5 +31,6 @@ urlpatterns = [
url(r'^admin/contest/$', TemplateView.as_view(template_name="admin/contest/add_contest.html"), name="add_contest_page"),
url(r'^problems/$', TemplateView.as_view(template_name="oj/problem/problem_list.html"), name="problem_list_page"),
url(r'^admin/template/(?P<template_dir>\w+)/(?P<template_name>\w+).html', AdminTemplateView.as_view(), name="admin_template")
url(r'^admin/template/(?P<template_dir>\w+)/(?P<template_name>\w+).html', AdminTemplateView.as_view(), name="admin_template"),
url(r'^api/admin/group/$', GroupAdminAPIView.as_view(), name="group_admin_api"),
]